mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-31 04:28:51 +00:00
Documentation Update
This commit is contained in:
@@ -42,6 +42,19 @@ $spreadsheet->getActiveSheet()
|
||||
If you make a call to `getCell()`, and the cell doesn't already exist, then
|
||||
PhpSpreadsheet will create that cell for you.
|
||||
|
||||
### Copying a Cell's Value And Style Adjusting Formulas
|
||||
|
||||
If cell A1 contains `5`, cell A2 contains `10`, and cell `B1` contains `=A1`, the formula in B1 will be evaluated as `5`. In Excel, if you copy B1 to B2, B2 will wind up with the adjusted formula `=A2` and will be evaluated as 10. Until release 5.1.0, PhpSpreadsheet requires the program to perform its own formula adjustment. In 5.1.0, a new method is introduced to handle formula adjustments:
|
||||
```php
|
||||
$worksheet->copyformula($fromCell, $toCell);
|
||||
```
|
||||
This will behave as Excel does. If $fromCell does not contain a formula, its contents will be copied as-is.
|
||||
|
||||
If you also want to copy $fromCell's style, as Excel does, you can use the following (available in all supported releases):
|
||||
```php
|
||||
$worksheet->duplicateStyle($fromCell->getStyle(), $toCell);
|
||||
```
|
||||
|
||||
### BEWARE: Cells and Styles assigned to variables as a Detached Reference
|
||||
|
||||
As an "in-memory" model, PHPSpreadsheet can be very demanding of memory,
|
||||
|
||||
Reference in New Issue
Block a user