ExcelWriterXML
[ class tree: ExcelWriterXML ] [ index: ExcelWriterXML ] [ all elements ]

Class: ExcelWriterXML

Source Location: /ExcelWriterXML.php

Class Overview


Class for generating the initial Excel XML document


Author(s):

  • Robert F Greer

Version:

  • 1.0

Variables

Methods



Class Details

[line 37]
Class for generating the initial Excel XML document

  1.  <?php
  2.  $xml new ExcelWriterXML;
  3.  $format $xml->addStyle('StyleHeader');
  4.  $format->fontBold();
  5.  $sheet $xml->addSheet('Test Sheet');
  6.  $sheet->writeString (1,1,'Header1','StyleHeader');
  7.  $sheet->writeString(2,1,'My String');
  8.  $xml->sendHeaders();
  9.  $xml->writeData();
  10.  ?>




Tags:

author:  Robert F Greer
version:  1.0
link:  http://msdn.microsoft.com/en-us/library/aa140066(office.10).aspx


[ Top ]


Class Variables

$formatErrors = array()

[line 40]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor ExcelWriterXML [line 62]

ExcelWriterXML ExcelWriterXML( [string $fileName = 'file.xml'])

Constructor for the ExcelWriterXML class.

A default style is created, a filename is generated (if not supplied) and the create time of the document is stored.




Tags:

return:  Instance of the class


Parameters:

string   $fileName   This is the filename that will be passed to the browser. If not present it will default to "file.xml"

[ Top ]

method addError [line 112]

void addError( $function, string $message)

Adds a format error. When the document is generated if there are any errors they will be listed on a seperate sheet.



Tags:

access:  public


Parameters:

string   $message   Details of the error
   $function  

[ Top ]

method addSheet [line 183]

ExcelWriterXML_Sheet addSheet( [string $id = null])

Creates a new sheet within the spreadsheet At least one sheet is required.

Additional sheets cannot have the same name as any other sheet. If a sheet has the same name as another sheet then it will follow the default naming convention as if $id was null




Tags:

return:  Reference to a new sheet class
access:  public


Parameters:

string   $id   The name of the sheet. If left blank then the sheet will default to "Sheet" + n (e.g. "Sheet1")

[ Top ]

method addStyle [line 151]

ExcelWriterXML_Style addStyle( [string $id = null])

Creates a new style within the spreadsheet.

Styles cannot have the same name as any other style. If a style has the same name as another style then it will follow the default naming convention as if $id was null




Tags:

return:  Reference to a new style class
access:  public


Parameters:

string   $id   The name of the style. If left blank then the style will default to "CustomStyle" + n (e.g. "CustomStyle1")

[ Top ]

method checkStyleID [line 225]

boolean checkStyleID( string $id)

Checks whether a proposed Style ID has already been used



Tags:

return:  True if the id is unique, false otherwise
access:  public


Parameters:

string   $id   The style id to be checked

[ Top ]

method docAuthor [line 391]

void docAuthor( [string $author = ''])

Sets the Author of the document



Tags:

access:  public


Parameters:

string   $author   Part of the properties of the document.

[ Top ]

method docCompany [line 403]

void docCompany( [string $company = ''])

Sets the Company of the document



Tags:

access:  public


Parameters:

string   $company   Part of the properties of the document.

[ Top ]

method docManager [line 397]

void docManager( [string $manager = ''])

Sets the Manager of the document



Tags:

access:  public


Parameters:

string   $manager   Part of the properties of the document.

[ Top ]

method docSubject [line 385]

void docSubject( [string $subject = ''])

Sets the Subject of the document



Tags:

access:  public


Parameters:

string   $subject   Part of the properties of the document.

[ Top ]

method docTitle [line 379]

void docTitle( [string $title = ''])

Sets the Title of the document



Tags:

access:  public


Parameters:

string   $title   Part of the properties of the document.

[ Top ]

method getDefaultStyle [line 138]

ExcelWriterXML_Style getDefaultStyle( )

Gets the default style that was created by the contructor.

This is used when modifications to the default style are required.




Tags:

return:  Reference to a style class
access:  public


[ Top ]

method mysqlTableDump [line 414]

void mysqlTableDump( string $host, string $username, string $password, string $db, mixed $table, [mixed $alternateName = null])

Outputs a MYSQL table or list of tables to an Excel doc



Tags:

access:  public


Parameters:

string   $host   MySQL host to connect to
string   $username   Username to connect with
string   $password   Password to connect with
string   $db   Database to use
mixed   $table   If string, out specific table. If array, each table will have it's own sheet
mixed   $alternateName   For multiple tables this does nothing. For table, overrides auto naming of the sheet (table name)

[ Top ]

method overwriteFile [line 82]

void overwriteFile( [boolean $overwrite = true])

Whether or not to overwrite a file (when writing to disk)



Tags:

access:  public


Parameters:

boolean   $overwrite   True or False

[ Top ]

method sendHeaders [line 125]

void sendHeaders( )

Sends the HTML headers to the client.

This is only necessary if the XML doc is to be delivered from the server to the browser.




Tags:

access:  public


[ Top ]

method showErrorSheet [line 96]

void showErrorSheet( [boolean $show = true])

Whether or not to show the sheet containing the Formatting Errors



Tags:

access:  public


Parameters:

boolean   $show  

[ Top ]

method writeData [line 240]

void writeData( [string $target = null])

Writes the XML data



Tags:

access:  public


Parameters:

string   $target   If left null the function will output to STD OUT (e. g. browser or console)

[ Top ]


Documentation generated on Thu, 25 Feb 2010 16:36:54 -0600 by phpDocumentor 1.4.1