When using
In fact, among many methods, I feel that Spreadsheet_Excel_Writer in Pear is very useful. This article will not introduce the installation of PHP Spreadsheet_Excel_Writer.
The following is the quoted content of PHP Spreadsheet_Excel_Writer:
- < ?php
- //Call Writer.php
- require_once 'Spreadsheet/Excel/Writer.php';
- //Create Workbook
- $workbook = new Spreadsheet_Excel_Writer();
- //Define export Excel file name
- $workbook->send('test.xls');
- //Create Worksheet
-
$worksheet =& $workbook->addWorksheet('My first worksheet');
- //Set font size
-
$format_column = & $workbook->addformat(array('Size'=>9,'Bold'=>1));
- //Data writing
- //Title row (first line)
-
$worksheet->write(0, 0, 'Name', $format_column);
-
$worksheet-> write(0, 1, 'Age', $format_column);
- //The first person (second line)
-
$worksheet->write(1, 0, 'John Smith' );
-
$worksheet->write(1, 1, 30 );
- //The second person (third line)
-
$worksheet->write(2, 0, 'Johann Schmidt');
-
$worksheet->write(2, 1, 31);
- //The third person (fourth line)
-
$worksheet->write(3, 0, 'Juan Herrera' );
-
$worksheet->write(3, 1, 32 );
- //Close Workbook
-
$workbook-> close(); 🎜>
The above code example is the specific usage of PHP Spreadsheet_Excel_Writer. -
http://www.bkjia.com/PHPjc/446092.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446092.htmlTechArticleIn fact, among many methods, I feel that Spreadsheet_Excel_Writer in Pear is very easy to use. This article will not introduce the installation of PHP Spreadsheet_Excel_Writer. The following is PHP Spreadsheet_E...