Re: PEAR Spreadsheet_Excel_Writer setLocked method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hey all,

Any one use the PEAR Spreadsheet_Excel_Writer package?

I need to know how to implement the setLocked method to lock out a cell, but can't figure out how this would be done.

Do you add it as a format? But then how is it applied to a cell. It's not documented on the PEAR pages.

Any help as always is greatly appreciated.

Also, what about making a cell span more than one cell below and above it? I can't find a way to do this either.

Thanks,
Skip



I've used it for some time but never needed to lock a cell. Here is a piece of code that shows how to apply a format to a cell:

<?php
// Include the PEAR script
require 'Spreadsheet/Excel/Writer.php';

// Stop displaying the errors so that the warnings don't get in your spreadsheet
// ini_set('display_errors',0);

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

// Send it directly to the browser
$workbook->send("test.xls");

// Set the version (very useful for compatibility)
$workbook->setVersion(8);

// Create a worksheet in the workbook
$worksheet =& $workbook->addWorksheet('Test');

// Set input encoding
$worksheet->setInputEncoding('UTF-8');

// Create a format
$format_bold =& $workbook->addFormat();
$format_bold->setBold();
$format_bold->setHAlign('center');
$format_bold->setFgColor('yellow');

// Apply the format to a cell
$worksheet->writeString(0, 0, "Test content", $format_bold);

// Close the workbook
$workbook->close();
?>

Hope it helps. I think that by doing something like this:

$format_bold->setLocked();

while creating the format could do the trick but it is not tested.

--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux