Thread

Posted on Fri Mar 7 01:53:18 2008 by wayland
Numeric sheet names
Hi. I regularly receive a spreadsheet from someone else where the names of the sheets are the names of the last 10 years (ie. 200, 2001, ..., 2008). The limitation on numeric sheet names is thus a problem. My first question is whether there's any way around it. I'd also like to make the suggestion that either there be a way to indicate whether you want numeric sheet names or not, or that when given a number, it search, say, the first 10 sheets for a sheet with that number as its name. :)
Direct Responses: 7286 | Write a response
Posted on Fri Mar 7 11:26:18 2008 by jmgdoc in response to 7285
Re: Numeric sheet names

Hi,
You could use the generic selectElementByAttribute() in order to select a table by name, whatever the name (numeric or not). Just remember that, according to the Open Document specification, the XPath expression for table is "//table:table" and the name attribute for a table is "table:name". So, the following code allows you to retrieve a table according to its name, even if this name is numeric:
my $table = $doc->selectElementByAttribute('//table:table', 'table:name', $any_name);

Note that O::O doesn't prevent you from creating tables with numeric names using appendTable() or insertTable() as well:
$doc->appendTable("2001", $rows, $cols);
in addition, you could set a numeric name to an existing table:
$doc->tableName($table, "2001");
but you should check the compatibility with your office software.
Write a response