Developer Guide
Overview
This section covers the core capabilities of Aspose.Cells FOSS for PHP. All public
classes live in the Aspose\Cells_FOSS namespace, and Workbook is the entry point for
every task: create or load one, operate on its worksheets and cells, then call Save().
Core Cell Operations
Store typed values and formulas with Cell::PutValue() and the Cell->Formula property:
<?php
require __DIR__ . '/vendor/autoload.php';
use Aspose\Cells_FOSS\Workbook;
$workbook = new Workbook();
$sheet = $workbook->Worksheets[0];
$sheet->Cells['A1']->PutValue(42500.75);
$sheet->Cells['B4']->Formula = '=SUM(B2:B3)';
$workbook->Save('core.xlsx');XLSX Packaging
An .xlsx file is an OOXML ZIP package. Workbook::Save() writes the required parts
automatically; saving is currently limited to the .xlsx format. See
Working with Packaging for the lower-level package model.
Navigating Workbooks
Reach any worksheet or cell from the Workbook object graph: $workbook->Worksheets[$index]
for sheets, $sheet->Cells['A1'] for cells by name. See
Working with Navigation for hyperlinks.
Save-Time Validation
Before a workbook is written, WorkbookValidator checks the in-memory model for structural
issues. See Working with Validation.
Tips and Best Practices
Cell::GetStyle()returns a copy, not a live reference: mutate the returnedStyle(and itsFontvia$style->Font), then write it back explicitly withCell::SetStyle().- Saving only supports
.xlsx. - Enable
LoadOptions->TryRepairXmlandTryRepairPackagebefore loading files of unknown quality, then check$workbook->LoadDiagnostics->HasDataLossRisk.
Common Issues
| Issue | Cause | Fix |
|---|---|---|
Load fails on a questionable .xlsx file | Corrupt ZIP or malformed XML | Load with a LoadOptions instance and set TryRepairPackage/TryRepairXml to true, then inspect LoadDiagnostics |
| Formula shows a stale result | Aspose.Cells FOSS does not calculate formulas | Open the file in Excel/LibreOffice, which recalculates on open |
FAQ
Which file formats are supported?
Only .xlsx (Excel Open XML). There is no .xls, .csv, or .ods support in this
release.
Does the library evaluate formulas?
No. The Formula property stores the formula text; the value is recalculated by Excel
or another spreadsheet application when the file is opened.
Is a license key required?
No. Aspose.Cells FOSS for PHP is distributed under the MIT License with no license file or key.
API Reference Summary
| Class/Method | Description |
|---|---|
Workbook | Entry point; represents an Excel workbook |
Workbook::Save($path) | Writes the workbook as .xlsx |
Cell::PutValue($value) | Stores a typed value |
Cell->Formula | Formula text stored on a cell |
Cell::GetStyle() / Cell::SetStyle($style) | Reads/writes cell formatting |
LoadOptions->TryRepairXml / TryRepairPackage | Enables repair during load |
WorkbookValidator::ValidateForSave(...) | Structural validation run before save |
Topics
- Features: Full feature-area walkthrough
- Working with Core API: Typed values, formulas, and styling
- Working with Packaging: XLSX ZIP package model
- Working with Navigation: Worksheets, cells, and hyperlinks
- Working with Validation: Save-time structural validation