1. Products
  2.   Spreadsheet
  3.   PHP
  4.   Aspose.Cells for PHP via Java

Aspose.Cells for PHP via Java


PHP API to Generate & Convert Excel Spreadsheets

A useful Excel spreadsheet management and processing API allows developers to create, edit, print, read, and convert Excel files.

Aspose.Cells for PHP via Java is a useful and flexible solution for working with Excel spreadsheets documents inside PHP applications. It is a very popular spreadsheet manipulation API that enables software developers to create, modify, read, print, and convert Microsoft Excel files without the need for Microsoft Excel to be installed on the system. The library fully supports all versions of Microsoft Excel, including the latest versions of Excel 2019 and Excel for Office 365.

Aspose.Cells for PHP via Java is a scalable and feature rich API that helps software developers quickly and reliably, convert between several popular document formats inside their own PHP applications. It provides software for most complete XLS format, OOXML, Flat OPC and also Excel 2003 XML, XLSX, XLTX, XLSM, XLTM, CSV, HTML, ODS, PDF, tab-delimited file format, and many more. It is also possible to easily extract text by saving it in plain text format. With Aspose.Cells for PHP via Java, developers can use the API from within PHP applications by using the Java Bridge. The library is designed for high performance, allowing developers to work with large Excel files quickly and efficiently.

Aspose.Cells for PHP via Java works by using the Java Bridge to create a connection between the PHP application and the Aspose.Cells API. There are several important Excel spreadsheet manipulation features part of the library such as adding a new workbook, inserting a new worksheet, creating and manipulating comments, configuring page setup, inserting & render charts, formulas import from a designer spreadsheet, adding & calculate complex formulas, create & manipulate named ranges and many more. PHP via Java is a technique that allows developers to use Java classes and libraries from within PHP applications. It works by using a Java bridge, which is a piece of software that allows PHP scripts to interact with Java objects and classes.

Previous Next

Getting Started with Aspose.Cells for PHP via Java

Aspose.Cells for PHP via Java is distributed as a ZIP archive. You need to have PHP 7 or greater versions to be installed. The machine must have Oracle JDK 7 or greater versions before setting up the installation.

Here are the complete installation instructions for Aspose.Cells for PHP via Java.

Create & Manage New Excel Spreadsheet via PHP API

Aspose.Cells for PHP via Java gives software developers the capability to create new Excel spreadsheets inside their own PHP applications. The library also supports opening existing projects, make the require changes to it and update it accordingly. It supports various file formats, such as XLS, XLSX, ODS, SpreadsheetML, CSV, Tab Delimited, HTML/MHTML, PDF, XPS and other formats. The library has included several important features related to documents manipulation, such as adding a copy of existing worksheet, Importing/exporting data from external files, Insert images to spreadsheet, add comments to cells, Merge/split Cells and so on.

How to Create New Excel Workbook via PHP API?

// Load the Aspose.Cells library

use Aspose\Cells\Workbook;
use Aspose\Cells\Worksheets\SheetType;

// Create a new workbook
$workbook = new Workbook();

// Add a new worksheet
$worksheet = $workbook->getWorksheets()->add(SheetType::WORKSHEET);

// Save the workbook

// add data and formatting to the worksheet
// Add data to cell A1
$worksheet->getCells()->get("A1")->setValue("Hello, World!");

// Save the workbook

Import & Export Excel File Formats via PHP API

Aspose.Cells for PHP via Java library has included several important features that quickly and reliably, converts between several popular spreadsheet document formats. The library allows to input and out various important spreadsheets file formats, such as XLS, XLSX, XLSB, XLTX, XLTM, XLSM, XML, ODS, CSV, Tab-Delimited, TXT, HTML, MHTML. It also allows export to some popular file formats such PDF, XPS JPEG, PNG, BMP, SVG, TIFF, EMF, GIF and so on.

Convert Excel workbook to PDF via PHP

 use java\io\File;
use com\aspose\cells\Workbook;

// Load the Excel workbook
$workbook = new Workbook(new File("input.xlsx"));

use com\aspose\cells\SaveFormat;

// Save the workbook in PDF format
$workbook->save("output.pdf", SaveFormat::PDF);

Apply Formatting to Spreadsheets via PHP API

Aspose.Cells for PHP via Java makes it easy for computer programmers to apply different types of formatting to their spreadsheets documents. The library has included several important features for handling spreadsheets formatting, such as apply all characters formatting in the cells including fonts, colors, effects, borders and shading, text alignment settings, rich text formatting in a single cell, apply different cells border settings, manage background patterns on cells, apply all the number format settings and many more.

Add Charts & Images in Excel Files via PHP

Aspose.Cells for PHP via Java allows software developers to create and add charts as well as images into spreadsheet documents inside their own PHP applications. The library has included various important for handling charts and images, such as customizing charts, chart formatting types, rendering charts, manage Axes of excel charts, DataLabels & legend handling of Excel charts, add Excel charts titles, Excel 2016 Charts support, get equation Text of Chart Trendline and many more.  

Load Chart to Excel File inside PHP Applications

//Load the Excel file
$workbook = new Workbook("input.xlsx");

// add the chart to a worksheet

$chart = $workbook->getWorksheets()->get(0)->getCharts()->addChart(ChartType::COLUMN_CLUSTERED);
$chart->setChartArea(0, 0, 400, 400);
$chart->setPlotArea(0, 0, 350, 350);
$chart->getTitle()->setText("Sales Report");

$data = array(
    array("Product", "Sales"),
    array("Product A", 1500),
    array("Product B", 2500),
    array("Product C", 1700),

$chart->getNSeries()->add($workbook->getWorksheets()->get(0)->getCells()->importArray($data, '', 'A1'));