previousFormat::setVAlign (Previous) (Next) Format::setMergenext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Format::setHAlign

Format::setHAlign – Set cell alignment.

Synopsis

require_once "Spreadsheet/Excel/Writer.php";

void Format::setHAlign ( string $location )

Description

Set cell alignment. This is an alternative to setAlign()

Parameter

  • string $location - alignment for the cell

    left, center, right, fill, justify, merge, equal_space.

Note

This function can not be called statically.

Example

Using setHAlign()

<?php
require_once 'Spreadsheet/Excel/Writer.php';

$workbook = new Spreadsheet_Excel_Writer();
$worksheet =& $workbook->addWorksheet();

// put text at the top
$format_top =& $workbook->addFormat();
$format_top->setHAlign('top');
$format_top->setTextWrap(1);

// center the text horizontally
$format_center =& $workbook->addFormat();
$format_center->setHAlign('center');

// put text at the top and center it horizontally
$format_top_center =& $workbook->addFormat();
$format_top_center->setHAlign('top');
$format_top_center->setHAlign('center');

$worksheet->write(00'On top of the world!',
                  
$format_top);
$worksheet->write(10'c'$format_center);
$worksheet->write(20'tc'$format_top_center);

$workbook->send('align.xls');
$workbook->close();
?>
previousFormat::setVAlign (Previous) (Next) Format::setMergenext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.