Hello World

Aspose.Cells - Hello World

To write anything in the spreadsheet document using Aspose.Cells for Java in PHP, simply invoke the HelloWorld module.

PHP Code

 # Instantiating a Workbook object that represents a Microsoft Excel file.

$workbook = new Workbook();

# Note: when you create a new workbook, a default worksheet,
# "Sheet1", is added to the workbook by default.

# Accessing the first worksheet in the book ("Sheet1").

$sheet = $workbook->getWorksheets()->get(0);

# Access cell "A1" in the sheet.

$cell = $sheet->getCells()->get("A1");

# Input the "Hello World!" text into the A1 cell.

$cell->setValue("Hello World!");

# Saving the modified Excel file in the default (i.e., Excel 2003) format.

$file_format_type = new FileFormatType();

$workbook.save($data_dir . "HelloWorld.xls", $file_format_type->EXCEL_97_TO_2003);

print "Document has been saved; please check the output file.";

Download Running Code

Download Hello World (Aspose.Cells) from any of the social coding sites mentioned below: