I can see my personal blog specifically.
Arraytoexel
Based on Phpexel encapsulated array data exported to the Exel table by the tool class before use
Source code needs to import their own path Phpexel package path, in __construct to modify how to use
After the tool class is introduced
$exel =new arraytoexcel ($rowAttr, $options);
$exel->push ($data _for_export);
You need to define ROWATTR, Rowattr,options, $data _for_export define the $rowattr format, that is, to define the style of each row
$rowAttr =array (
' firstrowheight ' => ',////The height of the column name in the first row ' heights ' of '
=> ' //second row after height
);
defines the $options format, which defines the associated properties of the entire Exel file
$options =array (
' excelname ' => ', //Export the name of the Excel file
' creater ' => ',// creator,
' LastModified ' => ', //Recent modification Time
' title ' => ',//Current active theme
' subject ' => ',
' description ' => ' ,
' keywords ' => ',
' category ' => '
);
defines the $data_for_export format, which defines the values that each sheet needs to write
$data _for_export=[
[' Data ' =>[...], ' colattr ' =>[...], ' sheettitle ' =>[...]]
To write multiple sheet, just add one more array
$data _for_export=[
[' Data ' =>[...], ' colattr ' =>[...], ' sheettitle ' =>[...]],
[' Data ' =>[...], ' Colattr ' =>[...], ' sheettitle ' =>[...]]
Data: The two-dimensional array we want to insert
Colattr: Property settings for columns, in the form:
Array (//Column property setting
' colname ' => ',//Column name ' KeyName ' => ' in the first row
,//The key value
' width ' => ' // Width of column A
)
The title example of the Sheettitle:sheet table is written to a sheet
$data =array (...);
/two D array $colAttr =array (the ' A ' =>array (//Column's property setting ' ColName ' => ' platform number '),//column name of the first row ' KeyName ' => ' order_no ',//Each column corresponds to the value of the key value ' width ' =>25//a column width of the assigned array, ' B ' =& Gt;array (//Column's property setting ' ColName ' => ' platform name ',//Column name ' KeyName ' => ' Shop_name ' in the first row,//Each column corresponds to the
The key value of the assignment array ' width ' =>20//b column widths); The property of the row is set $rowAttr =array (' firstrowheight ' => ' 20 ',////The height of the column name in the first row ' heights ' => ' 20 ')
2-oo the height of the impossible); $options =array (' Excelname ' =>date (' y/m/d ', Strtotime ($start)). ' -'. Date (' y/m/d ', Strtotime ($end)). ' Sales order BOM ',//The name of the exported Excel file ' creater ' => ' seven ',//Founder, ' LastModified ' => ', Recently modified time ' title ' => ' Sales order list ',//current active theme ' subject ' => ' Sales order list ', ' description ' =>
' Data export ', ' keywords ' => ' data export ', ' category ' => ' current sales order schedule ');
What each sheet needs to write $data _for_export=[[' Data ' => $data,
' Colattr ' => $colAttr, ' sheettitle ' => ' current sales order schedule ']
];
$exel =new arraytoexcel ($rowAttr, $options);
$exel->push ($data _for_export);
Write multiple sheet
$data =array (...); /two D array//Column property setting $colAttr =array (' A ' =>array (//Column's property setting ' ColName ' => ' platform
Number ',//The first row of column name ' KeyName ' => ' order_no ',//column corresponding to the assignment array key value ' width ' =>25//a column width ), the ' B ' =>array (//Column's property setting ' ColName ' => ' platform name ',//Column name ' K of the first row
Eyname ' => ' shop_name ',//Each column corresponds to the key value ' width ' =>20//b column of the assigned array); The property of the row is set $rowAttr =array (' firstrowheight ' => ' 20 ',////The height of the column name in the first row ' heights ' => ' 20 ')
2-oo the height of the impossible); $options =array (' Excelname ' =>date (' y/m/d ', Strtotime ($start)). ' -'. Date (' y/m/d ', Strtotime ($end)). ' Sales order BOM ',//The name of the exported Excel file ' creater ' => ' seven ',//Founder, ' LastModified ' => ',
Recently modified time ' title ' => ' Sales order list ',//current active theme ' subject ' => ' Sales order list ', ' Description ' => ' data export ', ' keywords ' => ' data export ', ' category ' => ' the current sales order schedule '); What each sheet needs to write $data _for_export=[[' Data ' => $this _month
_refunds, ' colattr ' => $colAttr, ' sheettitle ' => ' the current refund order schedule ' ], [' Data ' => $refunds, ' colattr ' => $colA
TTR, ' sheettitle ' => ' a schedule of previous refund orders '];
$exel =new arraytoexcel ($rowAttr, $options);
$exel->push ($data _for_export);
Todo[] Add TP support [] add laravel support [] composer Packagist