MarkBaker on Format-Masks_Improved-@
MarkBaker on master
Improved handling of @ format m… (compare)
MarkBaker on master
Improved handling of @ format m… Merge pull request #3344 from P… (compare)
MarkBaker on Format-Masks_Improved-@
Improved handling of @ format m… (compare)
<?php
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');
$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');
Error is :
[InvalidArgumentException]
Package phpoffice/phpspreadsheet at version has a PHP requirement incompat ible with your PHP version (5.4.16)
Any idea how to fix?
<?php
include_once 'include/bootstrap.php'; // Adjust bootstrap to your environment.
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
print "[".date("Y-m-d H:i:s",time())."] Start Data Population.\n";
$spreadsheet = new Spreadsheet();
$spreadsheet->setActiveSheetIndex(0);
$columnLookup = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // Limit to 26 columns
//$numberOfRows = 2500; // Takes Seconds
//$numberOfRows = 25000; // Take Minutes
$numberOfRows = 50000; // Take Minutes
//$numberOfRows = 250000; // Takes Hours
for ($row = 1; $row <= $numberOfRows; $row++) {
for ($column = 1; $column <= 26; $column++) {
$columnChar = substr($columnLookup, ($column -1), 1);
$spreadsheet->getActiveSheet()
->getCell("{$columnChar}{$row}")
->setValueExplicit(
"{$columnChar}{$row}",
\PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING
);
}
if ($row % 1000 == 0) print "."; // show progress once in awhile..
}
print "\n";
print "[".date("Y-m-d H:i:s",time())."] End Data Population.\n";
print "[".date("Y-m-d H:i:s",time())."] Start File Creation.\n";
$writer = new Xlsx($spreadsheet);
$writer->setPreCalculateFormulas(false); // Has no affect given the spreadsheet has no formulas!
$writer->save('/tmp/xlsxExample.xlsx'); // This takes --forever-- ..but why?
print "[".date("Y-m-d H:i:s",time())."] End File Creation.\n";
.xls
file, which is formatted as HTML plain text. When I read the file using the \PhpOffice\PhpSpreadsheet\Reader\Html
reader and then save the file as "Microsoft Excel 97-2003 (.xls)" format and use the \PhpOffice\PhpSpreadsheet\Reader\Xls
the rows in the array from the worksheet are different. Is there any reason for this?
Hello! Wasn't sure where to post, but I wanted to raise the point that lack of support for MS excel "format as table" creates accessibility issues. "Format as table" is the most widely supported technique for screen readers to properly associate column headers.
Here's a link to the official guide for making accessible Excel files (for meeting US laws):
https://www.section508.gov/create/spreadsheets
It seems like "format as table" is realized using pivot tables...
Related issues on github: #972 #840 #358
Related questions on stackoverflow:
https://stackoverflow.com/questions/55907831/phpspreadsheet-tables-get-lost-in-the-process
https://stackoverflow.com/questions/50934401/phpspreadsheet-multiple-tables-with-format-as-table-in-excel-worksheet
duplicateStyle
copy just the format not the merge property of the cells
Hello. I want to ask. How do I make a data automatically move to a new page if the data is separate in the php excel?
I have dynamic data. So my data can change
besides that I also have a data signature that cannot be separated.
This signature data must be on the same page. See the red mark in this image :
It is a unit and cannot be separated. Signature data
must be on the same page
My problem is because my data is dynamic. This makes the position of the signature data can be located in any position. See image below :
Because my data increases, the position of the headmaster in the signature data is separate
How do I make signature data (see picture 1), which red marks automatically move to the next page if the data is separate?
0xa0
) between FOO
, BAR
and BAZ
.
PhpOffice\PhpSpreadsheet\Reader\Xls
instead of PhpOffice\PhpSpreadsheet\Reader\Html
if will preserve the cells content as is.
hey,
i use the following notation to generate xlsx and send them to user and its working fine on desktop
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");'.'
header("Content-Disposition: attachment; filename=' . "01simple.xlsx".'");
header("Cache-Control: max-age=0");
However, when user tries to open file on Ipad he get xml formatted page insted. any suggestions?