当前位置:网站首页>Xlswriter - Excel export

Xlswriter - Excel export

2022-07-23 15:10:00 PHP code

 xlswriter It's a , Can be used in Excel 2007+ XLSX The data is read from the file , Insert multiple worksheets , Write text 、 Numbers 、 The formula 、 date 、 Chart 、 Pictures and hyperlinks .

 

 Why use  xlswriter

xlswriter  It's a  PHP C  Expand , Can be used in  Excel 2007+ XLSX  The data is read from the file , Insert multiple worksheets , Write text 、 Numbers 、 The formula 、 date 、 Chart 、 Pictures and hyperlinks .

 Please refer to the comparison chart below ; Due to memory ,PHPExcel  And  PHPSpreadSheet  In data volume   Relatively large   It doesn't work properly when , Although it can pass   modify memory_limit  Configure to solve memory problems , But it may take longer to finish the work ;

b2f549061c7b2a5fd9b5647383415634.png

 It supports the following functions :

 One 、 write in 

● 100% Compatible  Excel XLSX  file 

●  complete  Excel  Format 

●  merge cell 

●  Define worksheet name 

●  filter 

●  Chart 

●  Data validation and drop-down list 

●  Worksheet  PNG/JPEG  Images 

●  Memory optimization mode for writing large files 

●  Apply to  Linux,FreeBSD,OpenBSD,OS X,Windows

●  Compiled into  32  Bit and  64  position 

● FreeBSD  license 

●  The only dependence is  zlib

 Two 、 Read 

●  Read data completely 

●  The cursor reads data 

●  Read by data type 

1.2.8  New characteristics 

1、 The new date is written $config = [

'path' => './tests'

];

$fileObject = new \Vtiful\Kernel\Excel($config);

$fileObject = $fileObject->fileName('tutorial.xlsx');

$filePath = $fileObject->header(['date'])

->insertDate(1, 0, time(), 'mmm d yyyy hh:mm AM/PM')

->output();

2、 Add custom cell data type reading $config = [

'path' => './tests',

];

$fileObject = new \Vtiful\Kernel\Excel($config);

$fileObject->openFile('tutorial.xlsx')

->openSheet();

var_dump($fileObject->nextRow([

\Vtiful\Kernel\Excel::TYPE_STRING,

\Vtiful\Kernel\Excel::TYPE_TIMESTAMP,

]));

 The benchmark 

 Test environment :Macbook Pro 13 inch

Intel Core i5

16GB 2133MHz LPDDR3 Memory

128GB SSD Storage.

 export 

 Two memory modes , export  100W  Row data , A single  27  Column , Each cell  19  Chinese characters 

●  Normal mode : Time consuming  29S, Memory footprint  2083MB;

●  Fixed memory mode : Time consuming  52S,  Memory footprint  <1MB;

 Read 

 Read  100W  Row data , Each row  1  Column , The cell data is  int

●  Full read : Time consuming  3S,  Memory footprint  558MB;

●  Cursor read : Time consuming  2.8S,  Memory footprint  <1MB;

 Warehouse address 

 file 

End

 Please don't forget the last  star

 more PHP knowledge , Please visit PHP Chinese net PHP course !

原网站

版权声明
本文为[PHP code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207231016419701.html