Ask questionsMiss Dynamic Tables
- [ ] a bug report - [V] a feature request - [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
Open the excel file (.xlsx) with dynamic tables and save the same file with dynamic tables
The spreadsheet opens the excel file and saves the file without dynamic tables. Only plain text.
Use reader fuction to open the file Force to readonly Define a worksheet Use writer function to save the file
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
<?php require __DIR__ . '/vendor/autoload.php'; // Create new Spreadsheet object $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; // add code that show the issue here...
$inputFileName = 'template-sample.xlsx';
$inputFileType = IOFactory::identify($inputFileName); $reader = IOFactory::createReader($inputFileType); $reader->setReadDataOnly(true); $spreadsheet = $reader->load($inputFileName);
$writer = IOFactory::createWriter($spreadsheet, "Xlsx"); $writer->save("template-test.xlsx");
Answer questions MarkBaker
I just started work on the absolute basics of Pivot Tables for the Xlsx Reader/Writer two weeks ago... at the moment, I have some very simplistic code that just allows the pivot table to be read and written, without any form of editing or access to the data, just so that it won't get lost in a read/write; but that doesn't handle pivot tables that have any form of customisation (even something as basic as a custom style will trigger errors on the save) It's likely to take several months of work to get something robust enough to merge, and that depends how much time I get to work on it over the Summer.