Structures_DataGrid_Renderer_XLS

Structures_DataGrid_Renderer_XLS -- Excel Spreadsheet Rendering Driver

Supported operations modes

This driver supports the following operation modes:

Таблица 57-1. Supported operations modes of this driver

ModeSupported?
Container Supportyes
Output Bufferingno
Direct Renderingnot really, see below
Streamingno

Options

This driver accepts the following options:

Таблица 57-2. Options for this driver

OptionTypeDescriptionDefault Value
bodyFormatmixedThe format for body cells (either 0 [= "no format"] or a Spreadsheet_Excel_Writer_Format object) Please see the NOTE ABOUT FORMATTING below.0
borderintBorder drawn around the whole datagrid: 0 => none, 1 => thin, 2 => thick (NOT IMPLEMENTED YET)0
buildFooterboolWhether to build the footer.true
buildHeaderboolWhether to build the header.true
defaultCellValuestringWhat value to put by default into empty cells.null
defaultColumnValuesarrayPer-column default cell value. This is an array of the form: array(fieldName => value, ...).array()
encodingstringThe content encoding. If the mbstring extension is present the default value is set from mb_internal_encoding(), otherwise it is ISO-8859-1.'ISO-8859-1'
excludeVarsarrayVariables to be removed from the generated HTTP queries.array()
extraVarsarrayVariables to be added to the generated HTTP queries.array()
filenamestringThe filename of the spreadsheet'spreadsheet.xls'
fillWithEmptyRowsboolEnsures that all pages have the same number of rows.false
headerBorderintBorder between the header and body: 0 => none, 1 => thin, 2 => thick (NOT IMPLEMENTED YET)0
headerFormatmixedThe format for header cells (either 0 [= "no format"] or a Spreadsheet_Excel_Writer_Format object) Please see the NOTE ABOUT FORMATTING below.0
hideColumnLinksarrayBy default sorting links are enabled on all columns. With this option it is possible to disable sorting links on specific columns. This is an array of the form: array(fieldName, ...). This option only affects drivers that support sorting.array()
numberAlignboolWhether to right-align numeric values.true
sendToBrowserboolShould the spreadsheet be send to the browser? (true = send to browser, false = write to a file)true
startColintThe Worksheet column number to start rendering at0
startRowintThe Worksheet row number to start rendering at0
worksheetobjectOptional reference to a Spreadsheet_Excel_Writer_Worksheet object. You can leave this to null except if your workbook contains several worksheets and you want to fill a specific one.null

General notes

This driver does not support the flatten() method. You can not retrieve its output with DataGrid::getOutput(). You can either render it directly to the browser or save it to a file. See the "sendToBrowser" and "filename" options.

This driver has container support. You can use Structures_DataGrid::fill() with it; that's even recommended.

NOTE ABOUT FORMATTING:

You can specify some formatting with the 'headerFormat' and 'bodyFormat' options, or with setBodyFormat() and setHeaderFormat().

But beware of the following from the Spreadsheet_Excel_Writer manual: "Formats can't be created directly by a new call. You have to create a format using the addFormat() method from a Workbook, which associates your Format with this Workbook (you can't use the Format with another Workbook)."

What this means is that if you want to pass a format to this driver you have to "derive" the Format object out of the workbook used in the driver.

The easiest way to do this is:

// Create a workbook
$workbook = new Spreadsheet_Excel_Writer();

// Specify that spreadsheet must be sent the browser
$workbook->send('test.xls');

// Create your format
$format_bold =& $workbook->addFormat();
$format_bold->setBold();

// Fill the workbook, passing the format as an option
$options = array('headerFormat' => &$format_bold);
$datagrid->fill($workbook, $options);


HIVE: All information for read only. Please respect copyright!
Hosted by hive ÊÃÁ: Êèåâñêàÿ ãîðîäñêàÿ áèáëèîòåêà