OpenOffice-OODoc
view release on metacpan or search on metacpan
OODoc/Text.pod view on Meta::CPAN
Deletes the index mark owning the given identifier (if defined).
The first argument (mandatory) is the index mark identifier. The second
argument is the index type ('alphabetical index' or 'toc', the first one
is the default).
A context optional argument is provided; if so, the index entry is
deleted only if it's located in the given context.
If several index marks wrongly own the same identifier, they are
removed.
The method returns the number of physical deleted elements, that should
be 0 (if the index mark did not exist) or 2 (the start and the end
points). Any other return value means that deleteIndexMark() has cleaned
up a strange situation (less or more than two range delimiters).
See also deleteIndexMarks().
=head3 deleteIndexMarks([type [, context])
Without argument, deletes all the TOC marks and alphabetical index marks
in the document (or the default context).
The first argument, if set, non-blank and non-empty, restricts the
deletion to one type of index marks; it should be either 'toc' or
'alphabetical index' (unless the user need to remove non standard index
marks).
A particular context may set through the third argument in order to
restrict the index mark removal to the content of a particular element.
See also deleteIndexMark().
=head3 drawPageId(page [, new_id])
Returns the internal identifier of a presentation page, and changes
it if a second argument is provided. The page id is a positive
integer.
The first argument must comply to the same rules as with getDrawPage.
=head3 drawPageName(page [, newname])
Returns the visible name of a presentation or drawing page.
The first argument can be a page order number, a page element or the
present page name (see getDrawPage). The page is renamed if a
second argument is provided. Example:
$doc->drawPageName("oldname", "newname");
=head3 deleteTableColumn(table, col_num)
See deleteColumn().
=head3 deleteTableRow(table, row_num)
See deleteRow().
=head3 expandSheet()
Synonym of expandTable().
=head3 expandTable(table, height, width)
Increases the size of the given table or spreadsheet.
This method silently executes a full normalization of the table before
resizing it. See normalizeSheet() for details about this operation.
This method is specially useful in order to ensure the availability of
an appropriate workspace in a spreadsheet whose apparent size is
almost unlimited through the GUI of a typical desktop software but
but whose real size is unknown and/or doesn't include all the target
area of the application.
The vertical expansion is implemented by repetitive replication of the
last row, while the horizontal expansion is implemented by repetitive
replication of the last cell of the last row. So the new cells in the
right side are copies of the old bottom-right cell, while the new rows
are copies of the old last row.
Any size argument which is not larger than the previous height or width
is silently ignored, so method produces the same effect as
normalizeSheet() with the "full" parameter.
The return value is the table element itself in scalar context, or
the table size in array context.
Note that there is no direct method to shrink a table. However, it's
possible to do the job by deleting selected rows and or columns
through deleteTableColumn() and/or deleteTableRow().
=head3 extendText(element, text [, style [, offset]])
Inserts the text provided as the second argument into the element
specified by the first argument. The second argument may be either a
flat string or another existing text element.
If the 'text' argument is a paragraph or heading element, the text
content (and not the element itself) is inserted. But if 'text' is
any other element (for example: a variable text field or a sequence
of spaces), its inserted as is.
This method is an improvement of the general extendText() method
which is documented in the OpenOffice::OODoc::XPath manual page.
If a third argument is provided and is neither 0 nor an empty string,
it's regarded as the desired style of the new text, which is inserted
as a "styled span" (see setTextSpan() for details about text "spans").
By default, the text is inserted without any special style (i.e. with
the same style as the containing element).
The new text is, by default, appended to the existing content of the
element. However, if a valid numeric value is provided as the fourth
argument, the new text is inserted within the existing content, at the
given offset. If the offset is negative, it's counted backwards from
the end of the string. If it's set to 0, the insertion takes place at
the beginning.
$doc->createStyle
(
"BlueYellow",
family => "text",
OODoc/Text.pod view on Meta::CPAN
doesn't provide access to a covered cell.
The first argument can be either the sequential number of the table
(starting at 0), the logical name of the table, or a 'table' object
(which can be retrieved in advance using getTable). If it's a number
or a name, getTable() is automatically called by getTableCell() in
order to convert it in a 'table' object. However, if the first
argument is a row object (previously obtained via getRow() or
getHeaderRow()), the second one is processed as the column number.
Before using several cells in the same row, it's a good idea to get
the row object and then to use it in every cell selection, in order
to minimize the coordinates calculation.
In tables including one or more header rows, the best way to get a
header cell is to use a header row (previously obtained using
getHeaderRow()) as the first argument. If the first argument is a
table, getCell() looks in the table body only.
Alternatively, the user can provide the cell coordinates in a single
alphanumeric argument, beginning with one or two letters and ending
with one or more decimal digits, according to the same logic as in a
spreadsheet. So, for example
$doc->getTableCell($table, 'B12');
is equivalent to
$doc->getTableCell($table, 11, 1);
(Remember that, with the numeric coordinates, the row number is the
first argument, while with the alphanumeric, spreadsheet-like ones,
the column letter(s) come first.)
Numbers can also be negative, where position -1 is the last. For
example:
$cell = $doc->getCell(-1, -1, -1);
returns the very bottom right cell of the very last table in the
document $doc.
Returns a null value if the given cell does not exist or if it's
covered by the span of another cell.
Any cellXXX() method in this module uses the same cell addressing
logic as getTableCell().
CAUTION: Remember that OODoc works with the XML representation of
the tables, and not with the tables themselves. The [x,y] direct
addressing feature works as long as there is a continuous, one-to-one
mapping between the logical view and the physical XML storage of the
table. But, according to the OpenDocument specification, several
contiguous objects (cells or rows) are allowed to be mapped to a
single XML object when they have the same content and the same
style, in order to save some storage space. This optimization is
systematically used, for example, by OpenOffice.org Calc. In addition,
OODoc can't address a cell that could be displayed through the GUI
of a typical interactive spreadsheet software but that isn't stored
because it's not initialized yet. As a consequence, the direct
addressing logic of getTableCell() may require some preprocessing.
See normalizeSheet() and/or expandTable() about such preprocessing.
Remember that the table addressing is zero-based and
the row comes before the column in OpenOffice::OODoc, so, for
example:
$cell1 = $doc->getTableCell($table, 0, 0);
$cell2 = $doc->getTableCell($table, 31, 25);
returns respectively the A1 and Z32 cells.
Note: in a spreadsheet, (0,0) are the coordinates of the "A1" cell,
and, for example, (16, 25) are the coordinates of the "Z17" cell.
=head3 getTableColumn(table, column)
See getColumn.
=head3 getTableHeaderRow(table [, row_num])
Returns the element reference which corresponds to a row in a table
header, or undef if the given table has no header row.
The arguments are processes in the same way as with getRow(), but
the second argument is optional; it's required only if the table
has more than one header row (the 1st header row is returned by
default).
The returned elements can be used with subsequent cell access methods
in order to process header cells (see getTableCell()).
=head3 getTableList()
Returns a list of table elements in a document.
=head3 getTableRow(table, row)
See getRow.
=head3 getTableRows(table)
Returns the list of the rows contained in the given table.
When the user needs to process every row in large tables, this method
allows some performance improvements, because it's less costly than
a lot of successive getRow() calls.
=head3 getTableSize(table)
Returns the size of a table as a pair of values which represent the
number of rows and columns. The table can be specified either by
number, logical name or reference.
Example:
my ($rows, $columns) = $doc->getTableSize("Table1");
=head3 getTableText(n)
Returns the content of a table, if found, whose number or reference
OODoc/Text.pod view on Meta::CPAN
In the other hand, normalizeSheet() is not required to address a sheet
which has been created through the OODoc methods (provided that the
document has not been edited with another application software in the
meantime). These methods, i.e. appendTable() and insertTable(), create
normalized tables, whatever the document class.
Because this method is time and memory consuming, it should never
be used to reorganize the largest possible area of a sheet (meaning
thousands of rows and hundreds of columns that will probably never be
used). So it's action is limited to a given area, controlled by the
rows, columns arguments. When these arguments are not provided, the
method uses the 'max_rows' and 'max_cols' properties instead (see the
Properties section for other explanations). The processed area should
be sized in order to cover all the cells to be reached by the program,
and nothing more.
The first argument can be either the logical name of the sheet (as
it's shown in the bottom tab by OOo Calc), the sheet number, or a
table object reference, previously returned by getTable(). The return
value is the table object (or undef in case of failure).
Example:
$doc = odfDocument(file => 'report.ods');
my $sheet = $doc->normalizeSheet('Sheet1', 7, 9);
my $result = $doc->cellValue($sheet, 5, 6);
In the sequence above, a top left area of 7 rows by 8 columns is
pre-processed, so the cells from A1 to H6 of this sheet can be
reached according to the same addressing scheme as in Writer tables.
The last instruction gets the content of G6. Note that the second line
of this example could be replaced by
my sheet = $doc->getTable('Sheet1', 7, 9);
knowing that, when called with size arguments, getTable() automatically
executes normalizeSheet().
The following code normalizes the whole table, whatever its size (but
I don't recommend this option for tables containing thousands of rows
by hundred of columns):
$doc->normalizeSheet('Sheet1', 'full');
This last instruction could be automatically and silently executed
through the following one:
$doc->getTable('Sheet1', 'normalize');
The transformed sheets, of course, are readable by OOo Calc.
They simply take some more disk space when the processed spreadsheet
is saved. If the document is later read then written by OOo Calc,
the storage is optimized again, so the effects of normalizeSheet()
disappear.
normalizeSheet() is neutral against already normalized tables.
An explicit call to this method can be replaced by getTable() with the
additional length and width parameters. In addition, normalizeSheet()
is automatically executed before resizing each time a table is
processed by expandTable().
=head3 normalizeTable(table [, rows [, columns]])
See normalizeSheet().
=head3 outputDelimitersOn()
=head3 outputDelimitersOff()
Turns delimiters on or off. Used to mark up text exported by certain
methods like getText or selectTextContent.
The delimiters actually used depends on the table loaded into the
OODoc::Text instance via the 'delimiters' property.
=head3 outputTextConversion(text)
Returns the conversion in local character set of the given text,
supposed to be in UTF8. The local character set of the document
is used (see the 'local_encoding' property).
=head3 removeBookmark(id)
See deleteBookmark().
=head3 removeHeading(position [, level => level_no])
=head3 removeHeading(element)
Removes the given heading element.
Example:
$doc->removeHeading(4);
removes the 5th heading (whatever its level) counted from the
beginning of the document.
See getHeading() for the argument and option.
If the argument is an element reference (second form), the type is
not checked and this method becomes the equivalent of removeElement()
(which is documented with OpenOffice::OODoc::XPath generic methods).
=head3 removeHyperlink(path, position)
=head3 removeHyperlink(element)
Removes any hyperlink contained in the given element, leaving
in place the previously hyperlinked text.
=head3 removeParagraph(position)
=head3 removeParagraph(element)
Removes the paragraph at the given position (first form).
The paragraph to be removed can be indicated by element reference
(second form). In this case, the type of element is not checked and
this method becomes the equivalent of removeElement.
( run in 0.922 second using v1.01-cache-2.11-cpan-9581c071862 )