Worksheet::setColumn -- Set the width of a single column or a range of columns.
Description
Set the width of a single column or a range of columns.
Parameter
integer $firstcol - first column on the range
integer $lastcol - last column on the range
integer $width - width to set
mixed $format - The optional XF format to apply to the columns
integer $hidden - The optional hidden atribute
Note This function can not be called statically.
Example Example 24-1. Using setColumn()
require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer(); $worksheet =& $workbook->addWorksheet(); $radius = 20; $worksheet->setColumn(0,$radius*2,1); // Face for ($i = 0; $i < 360; $i++) { $worksheet->write(floor(sin((2*pi()*$i)/360)*$radius) + $radius + 1, floor(cos((2*pi()*$i)/360)*$radius) + $radius + 1, "x"); } // Eyes (maybe use a format instead?) $worksheet->writeURL(floor($radius*0.8), floor($radius*0.8), "0"); $worksheet->writeURL(floor($radius*0.8), floor($radius*1.2), "0"); // Smile for ($i = 65; $i < 115; $i++) { $worksheet->write(floor(sin((2*pi()*$i)/360)*$radius*1.3) + floor($radius*0.2), floor(cos((2*pi()*$i)/360)*$radius*1.3) + $radius + 1, "x"); } // hide gridlines so they don't mess with our Excel art. $worksheet->hideGridLines(); $workbook->send('face.xls'); $workbook->close();
Who's Online
Guest Users: 7
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?
More Sample Chapters