PHP Classes

File: export_fancy.php

Recommend this page to a friend!
  Classes of Charles A. LaFleur   Export Spreadsheets   export_fancy.php   Download  
File: export_fancy.php
Role: Example script
Content type: text/plain
Description: Exports a spreadsheet with 3 worksheets
Class: Export Spreadsheets
Create Excel spreadsheet from data in MySQL table
Author: By
Last change: Updated for v2.3
Date: 12 years ago
Size: 2,965 bytes
 

Contents

Class file image Download
<?php
// include the export_spreadsheet_class
require_once ("export_spreadsheets_class.php");

// create an instance of the export_spreadsheet_class object
$myExportFancy = new exportSpreadsheets();

// set instance properties
$myExportFancy->mysqlServer = "localhost";
$myExportFancy->mysqlUsername = "exportUser";
$myExportFancy->mysqlPassword = "exportPassword";
$myExportFancy->mysqlDatabaseName = "export_spreadsheets";
$myExportFancy->mysqlTableName = "export_table";

$fancy_workbook_array = array ();
$fancy_workbook_array['Tables & Chairs'] = array (
'sheet' => array ( 'sortFieldName'=>'organizationName', 'sortFieldDirection'=>'ASC','pageTitle'=>'', 'orientation'=>'portrait', 'numberPagesWide'=>'', 'numberPagesTall'=>'', 'repeatRows'=>'', 'repeatColumns'=>'', 'leftMargin'=>0.25, 'rightMargin'=>0.25, 'topMargin'=>0.25, 'bottomMargin'=>0.25, 'centerHorizontally'=>'yes','centerVertically'=>'yes' ),
'column1' => array ( 'fieldName'=>'boothNumber', 'columnTitle'=>'Booth', 'alignment'=>'center','sum'=>'no' ),
'column2' => array ( 'fieldName'=>'organizationName', 'columnTitle'=>'Organization', 'alignment'=>'left','sum'=>'no' ),
'column3' => array ( 'fieldName'=>'tablesNeeded', 'columnTitle'=>'Tables', 'alignment'=>'right','sum'=>'yes' ),
'column4' => array ( 'fieldName'=>'chairsNeeded', 'columnTitle'=>'Chairs', 'alignment'=>'right','sum'=>'yes' ),
);
$fancy_workbook_array['T-Shirts'] = array (
'sheet' => array ( 'sortFieldName'=>'', 'sortFieldDirection'=>'', 'pageTitle'=>'T-Shirts', 'orientation'=>'portrait', 'numberPagesWide'=>'', 'numberPagesTall'=>'', 'repeatRows'=>'', 'repeatColumns'=>'', 'leftMargin'=>0.25, 'rightMargin'=>0.25, 'topMargin'=>0.25, 'bottomMargin'=>0.25, 'centerHorizontally'=>'no','centerVertically'=>'yes' ),
'column1' => array ( 'fieldName'=>'boothNumber', 'columnTitle'=>'Booth', 'alignment'=>'center','sum'=>'no' ),
'column2' => array ( 'fieldName'=>'organizationName', 'columnTitle'=>'Organization', 'alignment'=>'left','sum'=>'no' ),
'column3' => array ( 'fieldName'=>'tshirtSize', 'columnTitle'=>'T-Shirt', 'alignment'=>'right','sum'=>'yes' ),
);
$fancy_workbook_array['Lunches'] = array (
'sheet' => array ( 'sortFieldName'=>'', 'sortFieldDirection'=>'', 'pageTitle'=>'', 'orientation'=>'portrait', 'numberPagesWide'=>'', 'numberPagesTall'=>'', 'repeatRows'=>'', 'repeatColumns'=>'', 'leftMargin'=>0.25, 'rightMargin'=>0.25, 'topMargin'=>0.25, 'bottomMargin'=>0.25, 'centerHorizontally'=>'','centerVertically'=>'' ),
'column1' => array ( 'fieldName'=>'boothNumber', 'columnTitle'=>'Booth', 'alignment'=>'center','sum'=>'no' ),
'column2' => array ( 'fieldName'=>'organizationName', 'columnTitle'=>'Organization', 'alignment'=>'left','sum'=>'no' ),
'column3' => array ( 'fieldName'=>'lunch', 'columnTitle'=>'Lunch', 'alignment'=>'right','sum'=>'yes' ),
);

$fancy_workbook_name = "fancy.xls";
$myExportFancy->export_spreadsheets($fancy_workbook_name,$fancy_workbook_array);

?>