Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17204 программиста и 1834 робота. Сейчас ищут 1638 программистов ...
Format::setAlign
Вернуться к: Spreadsheet_Excel_Writer
Format::setAlign
Format::setAlign – Set cell alignment.
Synopsis
require_once "Spreadsheet/Excel/Writer.php";
void Format::setAlign ( string $location )
Set cell alignment.
Parameter
-
string $location - alignment for the cell
Horizontal Alignments (pick one): left, center, right, fill, justify, merge, equal_space.
Vertical Alignments (pick one): top, vcenter, bottom, vjustify, vequal_space.
To implement a combination of Horizontal and Vertical Alignments, call this method two times.
Note
This function can not be called statically.
Example
Using setAlign()
<?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->setAlign('top');
$format_top->setTextWrap(1);
// center the text horizontally
$format_center =& $workbook->addFormat();
$format_center->setAlign('center');
// put text at the top and center it horizontally
$format_top_center =& $workbook->addFormat();
$format_top_center->setAlign('top');
$format_top_center->setAlign('center');
$worksheet->write(0, 0, 'On top of the world!',
$format_top);
$worksheet->write(1, 0, 'c', $format_center);
$worksheet->write(2, 0, 'tc', $format_top_center);
$workbook->send('align.xls');
$workbook->close();
?>
Вернуться к: Spreadsheet_Excel_Writer