How to Work with Navigation in PHP

How to Work with Navigation in PHP

A workbook is reached through a predictable object graph: Workbook->Worksheets holds the sheets, and each Worksheet->Cells grid can be indexed by name. This guide covers reaching worksheets, cells, and hyperlinks.

Step-by-Step Guide

Step 1: Install the Package

git clone https://github.com/aspose-cells-foss/Aspose.Cells-FOSS-for-PHP.git
cd Aspose.Cells-FOSS-for-PHP
composer install

Step 2: Import Required Classes

use Aspose\Cells_FOSS\Workbook;

Step 3: Reach a Worksheet and a Cell

$workbook = new Workbook('report.xlsx');
$sheet = $workbook->Worksheets[0];
$cell = $sheet->Cells['C3'];
echo $cell->StringValue . PHP_EOL;

Step 4: Work with Hyperlinks

Each worksheet’s HyperlinkCollection holds the Hyperlink objects attached to that sheet:

foreach ($sheet->Hyperlinks as $link) {
    echo $link->Address . PHP_EOL;
}

Common Issues and Fixes

Indexing Cells with an unknown address returns an unexpected cell. Cell addresses use standard A1-style notation (for example 'A1', 'C3'); confirm the string matches the exact column-letter/row-number format.

Frequently Asked Questions

Can I navigate by zero-based row/column index instead of an address string?

Consult the API reference for the exact overloads Cells exposes beyond the address-string accessor shown above.

See Also