.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "OODoc::Text 3pm" .TH OODoc::Text 3pm "2022-06-16" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" OpenOffice::OODoc::Text \- The text processing submodule of OpenOffice::OODoc .SH "DESCRIPTION" .IX Header "DESCRIPTION" This manual chapter describes the text-oriented methods of OpenOffice::OODoc, implemented by the OpenOffice::OODoc::Text class, and inherited by the OpenOffice::OODoc::Document class. .PP These methods are not essentially dedicated to string processing; they are more precisely focused on text containers. A text container is a document element which can (and must) be used in order to support a text and integrate it at the right place and according to the right presentation rules. The OpenDocument specification defines a lot of such containers, and the present \s-1API\s0 supports many of them, such as paragraphs, headings, tables (or spreadsheets), lists, sections, and draw pages. Some of these containers can host other containers: for example, a table contains rows, a row contains cells, a section can contain almost everything including other sections, etc. .PP These features are text-oriented, but can be used on documents of any class, such as spreadsheets or presentations as well as text documents. So, the \&'Text' word doesn't mean that the features described in the present manual chapter are dedicated to OpenDocument Text (\s-1ODT\s0) documents only. In the other hand, a few methods can't apply to any document class (ex: creating or retrieving draw pages makes sense with presentation and drawing documents only). .PP OODoc::Text should not be explicitly used in an ordinary application, because all its features are available through the OpenOffice::OODoc::Document class, in combination with other features. Practically, the present manual is provided to describe the text-oriented features of OpenOffice::OODoc::Document (knowing that these features are technically supported by the OpenOffice::OODoc::Text component of the \s-1API\s0). .PP The OpenOffice::OODoc::Text class is a specialist derivative of OpenOffice::OODoc::XPath for \s-1XML\s0 elements which describe the text content of OOo/ODF documents. Here, \*(L"text content\*(R" means containers that can host text containers (i.e. tables, lists...) as well as flat text. .PP Knowing that the \*(L"styles.xml\*(R" member of an OpenDocument file can contain text (because some style definitions, such as page headers or footers, can contain text), the presently described features can be used against this member as well as the \*(L"content.xml\*(R" member. .PP This module should be used in combination with OpenOffice::OODoc::Styles, via the OpenOffice::OODoc::Document class, if the application has to handle detailed presentation parameters of text elements. This is because such parameters are held in styles elements and not in the text elements themselves, according to the principle of separation of content and presentation which is one of the foundations of the OpenDocument format. .SS "Methods" .IX Subsection "Methods" \fIConstructor : OpenOffice::OODoc::Text\->new()\fR .IX Subsection "Constructor : OpenOffice::OODoc::Text->new()" .PP .Vb 1 \& Short Form: odfText() \& \& This constructor should not be explicitly used in ordinary applications \& knowing that all the features of the returned object are inherited by \& any Document object. \& \& See OpenOffice::OODoc::XPath\->new for common arguments. \& \& Returns an OODoc::XPath OpenDocument connector with additional \& features mainly focused on text containers. \& \& This constructor is generally not explicitly called, knowing that \& it\*(Aqs automatically triggered each time a Document object is created. \& \& The XML member loaded by default is \*(Aqcontent.xml\*(Aq. The most common \& creation method is like this: \& \& my $doc = odfText(file => \*(Aqmy_file.odt\*(Aq); \& \& This constructor should generally not be called directly, because it\*(Aqs \& inherited by odfDocument(). \& \& Other parameters can be supplied as options (see the properties list \& at the end of the chapter). \& \& Example: \& \& my %delim = \& ( \& \*(Aqtext:h\*(Aq => \& { \& begin => \*(Aq\esect{\*(Aq, \& end => \*(Aq}\*(Aq \& }, \& \*(Aqtext:list\-item\*(Aq => \& { \& begin => \*(Aq\eitem\*(Aq \& } \& \*(Aqtext:footnote\-body\*(Aq => \& { \& begin => \*(Aq\efootnote{\*(Aq, \& end => \*(Aq}\*(Aq \& } \& ); \& my $doc = odfText \& ( \& file => \*(Aqfilename.odt\*(Aq, \& paragraph_style => \*(AqMy Paragraphs\*(Aq, \& heading_style => \*(AqMy Headings\*(Aq, \& delimiters => { %delim } \& ); \& \& This technique gives the default styles to be used when creating new \& text elements. It also gives the particular delimiters (in this case \& LaTeX style markers) to be used at the beginning or end of some \& elements (in this case headings, list elements, footers) where the \& text is to be exported "as is". See the getText method of \& OODoc::Text for information about exporting text. .Ve .PP \fIappendDrawPage([options])\fR .IX Subsection "appendDrawPage([options])" .PP .Vb 2 \& In a presentation or drawing document, appends a new page at the en \& of the document. \& \& Possible options are: \& \& name => page name (unique) \& id => page numeric ID (unique) \& style => page style name \& master => master page name \& \& Returns the new draw page element if successful, undef if not. .Ve .PP \fIappendHeading([options])\fR .IX Subsection "appendHeading([options])" .PP .Vb 2 \& Creates a new heading of any level and appends it to the end of the \& document. \& \& Options are given as a hash [key => value]: \& \& \*(Aqtext\*(Aq => \& \*(Aqlevel\*(Aq => heading level, default is 1 \& \*(Aqstyle\*(Aq => heading style, default is \*(AqHeading 1\*(Aq \& \& Examples: \& \& $doc\->appendHeading(text => \*(AqNext section\*(Aq); \& \& adds the text \*(AqNext section\*(Aq as a level 1 heading. \& \& $doc\->appendHeading \& ( \& text => \*(AqChapter Conclusion\*(Aq, \& level => \*(Aq2\*(Aq, \& style => \*(AqHeading_20_2\*(Aq \& ); \& \& adds a level 2 heading to the end of the text body. \*(AqHeading_20_n\*(Aq \& styles, where \*(Aqn\*(Aq is the level number, are presently available by \& default in OpenOffice.org. \& \& You can give any XML attribute to the new heading except for style or \& heading level. In this case, the program must construct a hash \& containing pairs of key\-values for the attributes you want to create \& and pass it using the \*(Aqattribute\*(Aq option. Example: \& \& my %attr = ( \*(Aqatt1\*(Aq => \*(Aqvalue1\*(Aq, \*(Aqatt2\*(Aq => \*(Aqvalue2\*(Aq ); \& $doc\->appendHeading \& ( \& text => \*(AqAttributes are important\*(Aq, \& level => \*(Aq1\*(Aq, \& style => \*(AqChapter heading\*(Aq, \& attributes => {%attr} \& ); \& \& If the \*(Aqtext\*(Aq option is empty, the heading is created with an empty \& content. \& \& Caution, creating headings with level attributes is not always \& sufficient to produce the needed result. For example, in order to \& generate headings with appropriate levels of numbering, each one \& must be attached to the right position in a hierarchy of lists, \& in combination with appendItemList(), insertItemList(), and \& appendListItem(). \& \& Note: this method can only be used with a new header i.e. it adds \& while it creates. To add an already available element using \& getHeading() from the same document or from another document, use \& the appendElement() method instead which is inherited from \& OODoc::XPath. .Ve .PP \fIappendItem(list [, text => text ,style => style ,[other_options]])\fR .IX Subsection "appendItem(list [, text => text ,style => style ,[other_options]])" .PP .Vb 1 \& See appendListItem(). .Ve .PP \fIappendItemList([type => list_type, [style => style [, options]]])\fR .IX Subsection "appendItemList([type => list_type, [style => style [, options]]])" .PP .Vb 2 \& Creates a new (empty) list and appends it to the end of the \& document. \& \& In OpenOffice.org 1 documents, an unordered list is the default, \& and if the \*(Aqtype\*(Aq option is given with the value \*(Aqordered\*(Aq, then an \& ordered list is created. In Open Documents, the \*(Aqtype\*(Aq option is \& ignored because there are generic lists only (a list is ordered or \& "bulleted" according to a style, and not natively). \& \& The \*(Aqstyle\*(Aq options controls the list\*(Aqs style (as opposed to each \& item\*(Aqs style). If absent, the list takes the default paragraph style \& (see appendParagraph). \& \& Like appendParagraph, this method actually creates a new list \& element. To copy an existing list in the same document or in \& another, use appendElement or replicateElement instead. .Ve .PP \fIappendListItem(list [, text => text ,style => style ,[other_options]])\fR .IX Subsection "appendListItem(list [, text => text ,style => style ,[other_options]])" .PP .Vb 1 \& Adds a new item to a list (ordered or unordered). \& \& The first argument is the existing list element (created using \& getOrderedList or getUnorderedList, for example). Options are the \& same as for appendParagraph. \& \& If the \*(Aqstyle\*(Aq option is absent, the element is inserted according \& to the following rule: \& \& \- if the new item is not the first one of the list, it takes the \& same style as the first item; \& \& \- otherwise, it takes the default paragraph style of the document. \& \& The new item is created as a paragraph container by default. A \& \*(Aqtype\*(Aq option may be provided in order to require another type. \& Possible values are \*(Aqheader\*(Aq, \*(Aqparagraph\*(Aq or the XML name of any \& OpenDocument\-compliant text container. \& \& If the type is provided and set to undef, the new item is created \& as an empty element, so it could/should receive a content later. \& An empty item could be used as the attachment point of another \& list, in order to create a hierarchy of lists. .Ve .PP \fIappendParagraph()\fR .IX Subsection "appendParagraph()" .PP .Vb 1 \& Creates a new paragraph and appends it to the document. \& \& Options: \& \& \*(Aqtext\*(Aq => \& \*(Aqstyle\*(Aq => \& \& An \*(Aqattribute\*(Aq option is also available under the same conditions as \& for the appendHeading method (see above). \& \& If the \*(Aqtext\*(Aq option is empty, calling this method is the equivalent \& of adding a line feed. \& \& If the \*(Aqstyle\*(Aq option is empty, the style from the \*(Aqparagraph_style\*(Aq \& property of the OODoc::Text instance is used. \& \& By default, the new paragraph takes place at the end of the document. \& But it\*(Aqs possible to attach it as the last child of an existing \& text container (ex: a table cell). To do so, the container must be \& provided through an \*(Aqattachment\*(Aq option. For example, to append a new \& paragraph in a table cell, one can write \& \& my $cell = $doc\->getTableCell("Table1", "B12"); \& $doc\->appendParagraph \& ( \& text => "The cell, reloaded", \& attachment => $cell \& ); \& \& Note: this method can only be used with a new paragraph i.e. it adds \& while it creates. To add an already existing paragraph using \& getParagraph from the same document or from another document, use \& the appendElement, insertElement or replicateElement methods instead \& which are inherited from OODoc::XPath. \& \& Note: The repeated spaces are not properly processed, so any sequence \& of spaces (whatever its length) in the \*(Aqtext\*(Aq string is replaced by a \& single space in the target document. See setText() and extendText(). .Ve .PP \fIappendRow(table [, options])\fR .IX Subsection "appendRow(table [, options])" .PP .Vb 7 \& Appends a row to the end of the given table either by reference, by \& logical name or by sequential number. By default, the new row is \& simply an exact copy of the preceding row (in terms of content and \& presentation). You can pass an options hash which will give certain \& attributes to the created row, under the same conditions as for the \& appendElement method of OODoc::XPath. The returned value is the \& created row element. \& \& Example: \& \& open SRC, \*(Aq<\*(Aq, \*(Aqdata.txt\*(Aq; \& my $table = $doc\->getTable("Table1"); \& my ($h, $l) = $doc\->getTableSize($table); \& for (my $i = 0 ; my $record = ; $i++) \& { \& last unless $record; \& chomp $record; \& my @data = split \*(Aq;\*(Aq, $record; \& my $row = $i < $h ? \& $doc\->getRow($table, $i) : \& $doc\->appendRow($table); \& for (my $j = 0 ; $j < $l ; $j++) \& { \& $doc\->cellValue($row, $j, $data[$j]); \& } \& } \& \& The above program reads a CSV format data file sequentially (one \& record per line, comma\-separated fields). Each record is split and \& put into a row in table Table1. On reading each new record, the \& reference for the following row is loaded by getRow, until the total \& number of rows is reached (total obtained previously using \& getTableSize). If the table is already full, it is lengthened by a \& row using appendRow. The internal loop loads the read data into the \& row\*(Aqs cells (pre\-existing or newly created). See the sections on \& getTable, getRow, getTableSize and cellValue for a better \& understanding of this example. \& \& However, if good performance is what you are after, massive \& repetition of this method is not recommended (e.g. for lengthening a \& table dynamically, row by row, whilst loading external data into \& it). Rather than running dozens or hundreds of successive \& appendRows, it would be better for the application to read the total \& number of records to be loaded (using, for example, select count if \& from a relational database or otherwise preloading the data into an \& ordinary Perl table) and create a table of appropriate size in \& advance using insertTable() or appendTable(). .Ve .PP \fIappendSection(name [, options])\fR .IX Subsection "appendSection(name [, options])" .PP .Vb 6 \& Creates a new section with the given name, and appends it by default \& to the end of the document body. If the "attachment" option is \& provided, with an existing element as its value, the new section is \& appended in the context of this element. For example, if the value \& of "attachment" is an existing section, the new section is appended \& as the last sub\-section of the existing one. \& \& A section may be used either to hold a local content or to insert \& a subdocument which can be reached through an external link. \& \& In order to insert a subdocument link instead of an ordinary section, \& the application must provide a "link" option whose value is either a \& local file path or an URL. \& Example: \& \& $doc\->appendSection \& ( \& "Article", \& link => "http://mycompany.com/doc/article.odt" \& ); \& \& Other possible options: \& \& \*(Aqstyle\*(Aq allows the application to explicitly select a style \& for the new section \& \*(Aqprotected\*(Aq write\-protects the section when the document is \& edited; "true" or "false", default "false" \& \*(Aqkey\*(Aq in combination with "protected" => "true", write\- \& protects the section by password (the value of \& "key" is not the real password, but an encrypted \& password, so the end\-user will never remove the \& protection by simply typing the key as it is \& written in the program); see lockSection(), \& unlockSection() and sectionProtectionKey() .Ve .PP \fIappendTable(name, rows, columns [, options])\fR .IX Subsection "appendTable(name, rows, columns [, options])" .PP .Vb 5 \& Creates a new table with the given name, number of rows and number \& of columns, and appends it by default to the end of the document \& body. The name must be unique within the document (the call is \& rejected if the name already exists). Returns the created table \& element if successful. \& \& Beware: Creating simple tables from scratch is very easy; however, \& for a realistic application, it\*(Aqs strongly recommended to replicate \& XML table templates previously created with an ODF\-compatible editing \& software. A reasonably sophisticated table implies dozens of style \& definitions and would require a lot of perl code and a deep knowledge \& of the ODF specification, while it could be created in a few minutes \& through a WYSIWYG tool. \& \& \*(Aqrows\*(Aq and/or \*(Aqcolumns\*(Aq, if omitted, are replaced by the \*(Aqmax_rows\*(Aq \& and \*(Aqmax_cols\*(Aq properties of the document (see the properties below). \& \& By default, the table is set to fit the entire width between the \& left and right margins with equal sized columns, cells of type \& string and without borders or background colour. \& \& Possible options: \& \& \*(Aqtable\-style\*(Aq => table style \& \*(Aqcell\-type\*(Aq => default cell type \& \*(Aqcell\-style\*(Aq => default cell style \& \*(Aqtext\-style\*(Aq => default cell text style \& \& The first option is the name of a table style which defines \& certain global properties for the table (width, background colour, \& etc.). See the OpenOffice::OODoc::Styles manual for information about \& styles. \& \& The second option is the cells\*(Aq default data type. The main types \& available are string, float, currency, date, percentage. Caution: to \& be properly treated as having a numeric format in OOo/ODF, a \& cell needs more than to be just marked \*(Aqnumeric\*(Aq. If the cell really \& needs to be treated properly as a number, you must also give it a \& cell style which itself refers to a number style. The cell\-style \& parameter can do this. However, even though the OODoc::Styles module \& is there to otherwise help you create and add styles from a program, \& this type of exercise can become very labour\-intensive. We therefore \& recommend using basic tables created in advance from document \& templates or style libraries created from an office application, \& rather than creating complex number tables from code. \& \& The text\-style option selects the paragraph style applicable to the \& text displayed in each cell. \& \& Once the table is created, you can obviously modify each cell\*(Aqs type \& and style individually. \& \& Example: \& \& my $table = $doc\->appendTable \& ( \& "Rate", 22, 5, \& \*(Aqtable\-style\*(Aq => \*(AqTable1\*(Aq, \& \*(Aqtext\-style\*(Aq => \*(AqText body\*(Aq \& ); .Ve .PP \fIappendTableRow(table)\fR .IX Subsection "appendTableRow(table)" .PP .Vb 1 \& See appendRow. .Ve .PP \fI\f(BIautoSheetNormalizationOff()\fI\fR .IX Subsection "autoSheetNormalizationOff()" .PP .Vb 1 \& Deactivates the automatic sheet normalization. \& \& See autoSheetNormalizationOn(). .Ve .PP \fIautoSheetNormalizationOn('full')\fR .IX Subsection "autoSheetNormalizationOn('full')" .PP \fIautoSheetNormalizationOn(height, width)\fR .IX Subsection "autoSheetNormalizationOn(height, width)" .PP .Vb 6 \& Activates the automatic normalization of any used table. \& This method instructs the API to automatically normalize anything \& table or sheet as soon as it\*(Aqs reached through getTable() or another \& table\-related access method. The automatic normalization is not \& activated by default. It can be deactivated at any time using \& autoSheetNormalizationOff(). \& \& See normalizeSheet() for details about the arguments and the \& effects. .Ve .PP \fIbibliographyEntryContent(id [, key1 => value1, key2 => value2, ...])\fR .IX Subsection "bibliographyEntryContent(id [, key1 => value1, key2 => value2, ...])" .PP .Vb 3 \& Gets, and optionally sets, the properties of a given (existing) \& bibliographic entry. The optionally updated properties are provides \& as a hash. The returned description is a hash. \& \& The first argument can be either the logical identifier of the entry \& (as it appears for the end\-user) or a previously found bibliography \& entry element (see getBibliographyElements()). \& \& Example: \& \& my %desc = $doc\->bibliographyEntryContent \& ( \& "GEN99", \& author => \*(AqGenicorp\*(Aq, \& pages => 62 \& ); \& \& This sequence updates the "Author" and "Pages" values of the "GEN99" \& entry, then returns all the content of the entry in %desc. \& \& Caution: Several bibliography entries can have the same identifier. \& This method processes one element at a time. In the example above, \& only the first occurrence of the "GEN99" entries is updated. So, if \& the user needs to ensure that all the entries with the same identifier \& have the same content, the appropriate code should be something like: \& \& my @entries = $doc\->getBibliographyElements("^GEN99$"); \& foreach my $entry (@entries) \& { \& $doc\->bibliographyEntryContent \& ( \& $entry, \& author => \*(AqGenicorp\*(Aq, \& pages => 62 \& ) \& } \& \& Caution: This method allows the user to create any new property and \& to put any value in any property, without control. For information \& about the legal and/or recommended properties, see the OpenDocument \& specification and the OpenOffice.org bibliographic project \& (http://bibliographic.openoffice.org). .Ve .PP \fIbookmarkElement(element, name [, offset])\fR .IX Subsection "bookmarkElement(element, name [, offset])" .PP .Vb 1 \& See setBookmark(). .Ve .PP \fIcellCurrency(table, row, column [, currency])\fR .IX Subsection "cellCurrency(table, row, column [, currency])" .PP \fIcellCurrency(cell [, currency])\fR .IX Subsection "cellCurrency(cell [, currency])" .PP .Vb 3 \& Get/set the currency unit of a cell. \& If a currency is provided, the cell value type is automatically \& switched to \*(Aqcurrency\*(Aq. .Ve .PP \fIcellFormula(table, row, column [, formula])\fR .IX Subsection "cellFormula(table, row, column [, formula])" .PP \fIcellFormula(cell [, formula])\fR .IX Subsection "cellFormula(cell [, formula])" .PP .Vb 2 \& Accessor which returns the formula (or function) contained in the \& given table cell. Returns undef if no formula is found in the cell. \& \& The cell address is the same as for getCellValue(). \& \& If a formula is given as the last argument, it is put into the cell, \& overwriting any existing formula. No check of the syntax is carried \& out on the inserted formula. It is up to the application to insert a \& formula which conforms to OOo/ODF syntax. Example: \& \& $doc\->cellFormula(1,3,2, "sum "); \& \& Note 1: inserting or replacing a formula does not directly modify \& the value or text of the cell. Proper interpretation of a formula \& does not happen until the fields are updated when the document is \& reloaded into the office software. \& \& Note 2: syntax and functionality of cell formulae differ greatly \& between office applications. .Ve .PP \fIcellSpan(table, row, column [, hspan [, vspan]])\fR .IX Subsection "cellSpan(table, row, column [, hspan [, vspan]])" .PP \fIcellSpan(cell [, hspan [, vspan]])\fR .IX Subsection "cellSpan(cell [, hspan [, vspan]])" .PP .Vb 4 \& In a spreadsheet document, get/set the span of a table cell, \& knowing that this span can be one or more columns. The cell addressing \& is the same as with getTableCell(). \& Example: \& \& $doc\->cellSpan($table, "B4", 3); \& \& creates a 3\-cell span from B4 in a spreadsheet. \& \& With only one span argument, this method works for horizontal, left to \& right expansion. With an additional argument, the expansion is bi\- \& directional, covering one or more rows below the given cell. The \& horizontal span should be set to 1 in order to get a vertical span \& only. \& \& The text of the covered cells (if any) is concatenated to the original \& content of the expanded cell (as in OOo Writer or Calc). \& \& The user should make sure that the cell expansion will not invade the \& span of another, previously expanded cell. Assuming A is a the target \& of cellSpan(), B is an existing expanded cell, and C is a covered cell \& in the span of B, the following rules apply: \& \& If B is to be covered by the span of A, the span of B is automatically \& reset to 1, so C becomes visible, then B is covered by A. But if C is \& in the target range of cellSpan() while B is not, the method produces \& an inconsistency in the table (this inconsistency doesn\*(Aqt prevent \& OpenOffice.org and KSpread from loading the file but the span of A is \& just ignored). \& \& In list context, the method returns the horizontal span, then the \& vertical span. In scalar context, it returns the horizontal span only. \& \& Caution: when related to table cells, "span" has not the same \& meaning as when related to flat text (see getSpan() and setTextSpan()). .Ve .PP \fIcellStyle(table, row, column [, stylename])\fR .IX Subsection "cellStyle(table, row, column [, stylename])" .PP \fIcellStyle(cell [, stylename])\fR .IX Subsection "cellStyle(cell [, stylename])" .PP .Vb 1 \& Get or set the style of a table cell. .Ve .PP \fIcellValue(table, row, column [, value [, text]])\fR .IX Subsection "cellValue(table, row, column [, value [, text]])" .PP \fIcellValue(cell [, value [, text]])\fR .IX Subsection "cellValue(cell [, value [, text]])" .PP .Vb 1 \& Without the "value" argument: see getCellValue(). \& \& With "value" (and, optionally, "text"): see updateCell(). .Ve .PP \fIcellValueType(table, row, column [, type])\fR .IX Subsection "cellValueType(table, row, column [, type])" .PP \fIcellValueType(cell [, type])\fR .IX Subsection "cellValueType(cell [, type])" .PP .Vb 1 \& Get/set the data type of a table cell. \& \& Possible value types are \*(Aqstring\*(Aq, \*(Aqfloat\*(Aq, \*(Aqpercentage\*(Aq, \*(Aqcurrency\*(Aq, \& \*(Aqdate\*(Aq, \*(Aqtime\*(Aq, \*(Aqboolean\*(Aq. \& \& Note: If an application must convert a \*(Aqstring\*(Aq cell to a numeric \& one and fill it with a numeric value, cellValueType() must be called \& *before* cellValue(). Ex: \& \& my $cell = $doc\->getTableCell(\*(AqSheet1\*(Aq, 4, 8); \& $doc\->cellValueType($cell, \*(Aqfloat\*(Aq); \& $doc\->cellValue($cell, 12.34); .Ve .PP \fIcheckIndexMark(name, type [, context])\fR .IX Subsection "checkIndexMark(name, type [, context])" .PP .Vb 5 \& Checks the existence and validity of an index mark (see setIndexMark() \& for details about range index marks). The mandatory argument are the \& index entry identifier and the index entry type (namely \*(Aqtoc\*(Aq or \& \*(Aqalphabetical index\*(Aq. A context element may provided in order to \& restrict the search context. \& \& This method may return 1, 0 or undef. \& \& \*(Aq1\*(Aq means that the index mark is present and consistent; \& \& \*(Aq0\*(Aq means that the index mark is present in the context but not valid; \& \& undef means that the index mark doesn\*(Aqt exist in the context. \& \& If the result is 0, the are 2 possible reasons: the start point or the \& end point of the index mark has been found, but not both, or both have \& been found but there relative positions are wrong (the end is located \& before the start). Whatever the explanation, this result means that some \& cleaning should be done (see deleteIndexMark()). .Ve .PP \fIcheckRangeBookmark(name [, context])\fR .IX Subsection "checkRangeBookmark(name [, context])" .PP .Vb 4 \& Checks the existence and validity of a range bookmark (see setBookmark() \& for details about range bookmarks). The mandatory argument is the \& bookmark name. A context element may provided in order to restrict the \& search context. \& \& This method may return 1, 0 or undef. \& \& \*(Aq1\*(Aq means that the range bookmark is present and in the right order; \& \& \*(Aq0\*(Aq means that the bookmark is present in the context but not valid; \& \& undef means that the bookmark doesn\*(Aqt exist in the context. \& \& If the result is 0, the are 2 possible reasons: the start point or the \& end point of the range has been found, but not both, or both have been \& found but there relative positions are wrong (the end is located before \& the start). Whatever the explanation, this result means that some \& cleaning should be done (see deleteBookmark()). .Ve .PP \fIcolumnStyle(column_element [, style])\fR .IX Subsection "columnStyle(column_element [, style])" .PP \fIcolumnStyle(table, column [, style])\fR .IX Subsection "columnStyle(table, column [, style])" .PP .Vb 5 \& Returns the style name of the given column or replaces it with a new \& one. A column can be indicated either directly by reference or by \& the pair [table, column number]. The table itself can be indicated \& either by a table element, its number or its logical name. If the \& \*(Aqstyle\*(Aq argument is given, it replaces the old column style. \& \& Giving a column a style is actually the only way to control the \& width of a column in a table. \& \& Example: \& \& $doc\->columnStyle(\*(AqTable1\*(Aq, 2, \*(AqNewStyle\*(Aq); \& \& Caution: columns are numbered beginning at 0. .Ve .PP \fIcopyRowToHeader(table, rownum)\fR .IX Subsection "copyRowToHeader(table, rownum)" .PP \fIcopyRowToHeader(row)\fR .IX Subsection "copyRowToHeader(row)" .PP .Vb 3 \& This method appends a copy of a given table row to the header of the \& table. It may be called repeatedly, allowing multi\-row header \& creation. \& \& A table header is a row, or a sequence of rows, that is displayed at \& the top of a table and repeated at the top of every page if the table \& is spanned across more than one page. \& \& The given row remains in place unchanged; it\*(Aqs used as a template for \& the new header row. .Ve .PP \fIcreateParagraph([text [, style]])\fR .IX Subsection "createParagraph([text [, style]])" .PP .Vb 3 \& Creates a free paragraph for later use. Unlike appendParagraph() or \& insertParagraph(), this method doesn\*(Aqt attach the new paragraph to \& the document. \& \& Without arguments, the paragraph is created empty. The first argument, \& if any, provides the text content of the paragraph. The second one, \& if any, is regarded as the style name; the default style is \& "Standard". .Ve .PP \fIcreateTextBox(options)\fR .IX Subsection "createTextBox(options)" .PP .Vb 3 \& Creates a new text box. Can apply to any document class, but mostly \& used in presentations or drawings (where text boxes are required to \& host text content). \& \& Text boxes are implemented through frame element, so you should see \& createFrame() in the OpenOffice::OODoc::XPath manual chapter in order \& to understand the meaning of every option. \& \& The following options are allowed (and generally required in order \& to make a text box really visible and properly rendered): \& \& page: the page where the box must be attached; in presentations or \& drawings, this option should be set with the page name; \& \& name: the (unique) name of the text box; \& \& size: the size of the box; \& \& position: the page\-relative position; \& \& style: the graphic style of the box; like an image box, a text box \& often requires a style to be properly displayed; \& \& content: the content to be displayed in the box; if this option is \& set to a literal, the given content is inserted as a paragraph in \& the box; if the given value is the reference of an element, this \& element is attached as is in the box (so it\*(Aqs possible to insert \& any complex object, such as a table, an item list, etc). \& \& The method returns the reference of the new text box element. \& \& The example below creates an graphic style ("TB"), then a text box \& ("The Box") which uses the new style. See O::O::Styles for comments \& about createStyle(). The text box is attached in a presentation page \& identified by its name ("AnyPageName"). The size (width then height) \& and position (x, y) options are provided in centimeters (other units \& are allowed), each one in a single string. \& \& $doc\->createStyle \& ( \& "TB", \& family => "graphic", \& parent => "objectwithshadow", \& properties => \& { \& \*(Aqstyle:vertical\-pos\*(Aq => \*(Aqfrom\-top\*(Aq, \& \*(Aqstyle:horizontal\-pos\*(Aq => \*(Aqfrom\-left\*(Aq, \& \*(Aqstyle:vertical\-rel\*(Aq => \*(Aqpage\*(Aq, \& \*(Aqstyle:horizontal\-rel\*(Aq => \*(Aqpage\*(Aq \& } \& ); \& $doc\->createTextBox \& ( \& page => "AnyPageName", \& name => "The Box", \& size => \*(Aq12cm, 4cm\*(Aq, \& position => \*(Aq8cm, 14cm\*(Aq, \& style => \*(AqTB\*(Aq, \& content => "The text in the box" \& ); \& \& In this example, the content option is set to a flat text, so \& it will be inserted as a standard paragraph. If we want to insert \& a paragraph with a non\-default style, this option must be set to \& the reference of an existing paragraph (which may have been created \& using createParagraph() or copied from another place). .Ve .PP \fIdefaultOutputTerminator([chars])\fR .IX Subsection "defaultOutputTerminator([chars])" .PP .Vb 2 \& Get or set the default terminator character for text export. \& Example: \& \& $doc\->defaultOutputTerminator("\en"); \& \& After this instruction, a line\-break will be appended at the end of \& every paragraph or header exported by getText(), selectTextContent() \& or other text extracting methods. \& \& To reverse this behaviour, the user can call this method with an \& empty string. \& \& Without argument, returns the currently selected terminator, if any. .Ve .PP \fIdeleteBookmark(name [, context])\fR .IX Subsection "deleteBookmark(name [, context])" .PP .Vb 3 \& Deletes the bookmark owning the given name (if defined). \& A context optional argument is provided; if so, the bookmark is deleted \& only if it\*(Aqs located in the given context. \& \& If several bookmarks wrongly own the same name, they are removed. \& \& The method returns the number of physical deleted elements, i.e. 1 for \& a regular position bookmark, 2 for a range bookmark, 0 for nothing. Any \& other return value means that deleteBookmark() has cleaned up a strange \& situation (ex: more than one bookmark for a single name, a position \& bookmark with one start and many ends, and so on). \& \& Warning: if the context argument is set (or if the default current \& context is not the whole document), and if the bookmark to be deleted \& is not entirely included in the context, the result may be a partially \& deleted bookmark (wrong). \& \& See also deleteBookmarks(). .Ve .PP \fIdeleteBookmarks([context])\fR .IX Subsection "deleteBookmarks([context])" .PP .Vb 5 \& Delete all the bookmarks in the current context (by default the whole \& document) or in a given optional context, and returns the number of \& physical deleted elements (that may be greater than the number of \& deleted bookmarks, knowing that a bookmark may be stored a one or two \& XML elements). \& \& Warning: some inconsistencies may result if the context is not the whole \& document, knowing that a range bookmark could run across the border of \& the restricted context. \& \& See also deleteBookmark(). .Ve .PP \fIdeleteColumn(table, col_num)\fR .IX Subsection "deleteColumn(table, col_num)" .PP \fIdeleteColumn(col_elt)\fR .IX Subsection "deleteColumn(col_elt)" .PP .Vb 1 \& Deletes a given column in a given table. \& \& Caution: Before using this method, the application should ensure that \& the whole area from the beginning of the table to the last cell of the \& column to be deleted is "normalized". See normalizeSheet() for details \& about table normalization. .Ve .PP \fI\f(BIdeleteHeading()\fI\fR .IX Subsection "deleteHeading()" .PP .Vb 1 \& See removeHeading(). .Ve .PP \fIdeleteRow(table, row_num)\fR .IX Subsection "deleteRow(table, row_num)" .PP \fIdeleteRow(row_elt)\fR .IX Subsection "deleteRow(row_elt)" .PP .Vb 1 \& Deletes a given row in a table. .Ve .PP \fIdeleteIndexMark(id [, type [, context]])\fR .IX Subsection "deleteIndexMark(id [, type [, context]])" .PP .Vb 4 \& 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 (\*(Aqalphabetical index\*(Aq or \*(Aqtoc\*(Aq, the first one \& is the default). \& \& A context optional argument is provided; if so, the index entry is \& deleted only if it\*(Aqs 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(). .Ve .PP \fIdeleteIndexMarks([type [, context])\fR .IX Subsection "deleteIndexMarks([type [, context])" .PP .Vb 2 \& 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 \*(Aqtoc\*(Aq or \& \*(Aqalphabetical index\*(Aq (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(). .Ve .PP \fIdrawPageId(page [, new_id])\fR .IX Subsection "drawPageId(page [, new_id])" .PP .Vb 3 \& 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. .Ve .PP \fIdrawPageName(page [, newname])\fR .IX Subsection "drawPageName(page [, newname])" .PP .Vb 4 \& 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"); .Ve .PP \fIdeleteTableColumn(table, col_num)\fR .IX Subsection "deleteTableColumn(table, col_num)" .PP .Vb 1 \& See deleteColumn(). .Ve .PP \fIdeleteTableRow(table, row_num)\fR .IX Subsection "deleteTableRow(table, row_num)" .PP .Vb 1 \& See deleteRow(). .Ve .PP \fI\f(BIexpandSheet()\fI\fR .IX Subsection "expandSheet()" .PP .Vb 1 \& Synonym of expandTable(). .Ve .PP \fIexpandTable(table, height, width)\fR .IX Subsection "expandTable(table, height, width)" .PP .Vb 1 \& 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\*(Aqt 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\*(Aqs \& possible to do the job by deleting selected rows and or columns \& through deleteTableColumn() and/or deleteTableRow(). .Ve .PP \fIextendText(element, text [, style [, offset]])\fR .IX Subsection "extendText(element, text [, style [, offset]])" .PP .Vb 3 \& 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 \*(Aqtext\*(Aq argument is a paragraph or heading element, the text \& content (and not the element itself) is inserted. But if \*(Aqtext\*(Aq 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\*(Aqs 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\*(Aqs counted backwards from \& the end of the string. If it\*(Aqs set to 0, the insertion takes place at \& the beginning. \& \& $doc\->createStyle \& ( \& "BlueYellow", \& family => "text", \& properties => \& { \& "fo:color" => odfColor("blue"), \& "fo:background\-color" => odfColor("yellow") \& } \& ); \& my $p = $doc\->getParagraph(4); \& $doc\->extendText($p, "New text", "BlueYellow", 5); \& \& In the example above, "New text" is inserted at the offset 5 within \& the 5th paragraph, in blue letters on a yellow background. \& \& Of course, the offset argument can\*(Aqt be passed unless the style one is \& present. However, in order to pass an offset without setting a style, \& the application has just to provide a 0 or an empty string as the \& third argument. Example: \& \& $doc\->extendText($p, "New text", "", 5); \& \& Caution: the use of extendText() with the style and offset optional \& arguments is allowed for some simple situations; however, there are \& more powerful methods to insert additional text, with or without a \& particular style, within en existing element. See updatetext() and \& setTextSpan(). .Ve .PP \fIgetBibliographyElements([id])\fR .IX Subsection "getBibliographyElements([id])" .PP .Vb 2 \& Returns the list of the bibliographic entry elements contained in the \& document. \& \& If an argument is provided, the returned list is restricted to the \& bibliographic entries matching it (this argument can be a regexp). \& \& Example: \& \& my @biblio = $doc\->getBibliographyElements("^W3C"); \& \& returns the bibliographic entries where the identifier begins with \& "W3C". .Ve .PP \fIgetBookmark(name)\fR .IX Subsection "getBookmark(name)" .PP .Vb 2 \& Returns the bookmark element (if defined) corresponding to the given \& bookmark name. \& \& If the bookmark covers a range of text (i.e. if it\*(Aqs not a position), \& the returned element is the "bookmark start" one. .Ve .PP \fI\f(BIgetCell()\fI\fR .IX Subsection "getCell()" .PP .Vb 1 \& Synonym of getTableCell(). .Ve .PP \fIgetCellParagraph(table, row, column)\fR .IX Subsection "getCellParagraph(table, row, column)" .PP \fIgetCellParagraph(cell)\fR .IX Subsection "getCellParagraph(cell)" .PP .Vb 3 \& Returns the paragraph element contained in a given table cell, if \& the cell contains a paragraph. If the cell contains more than one \& paragraph, returns the first one. .Ve .PP \fIgetCellParagraphs(table, row, column)\fR .IX Subsection "getCellParagraphs(table, row, column)" .PP \fIgetCellParagraphs(cell)\fR .IX Subsection "getCellParagraphs(cell)" .PP .Vb 3 \& Returns the list of the paragraph elements contained in a given \& table cell (knowing that a single cell can contain one or more \& paragraphs). .Ve .PP \fIgetCellPosition(cell)\fR .IX Subsection "getCellPosition(cell)" .PP .Vb 5 \& Returns an array corresponding to the zero\-based, numeric coordinates \& of a table cell in a document, which can be used later to retrieve \& a cell at the same location through getCell(). The return values \& represent, in this order, the table, the row and the column. The header \& rows of the table, if any, are not counted. \& \& Example: \& \& my @coord = $doc\->getCellPosition($cell); \& \& A triplet such as (2, 4, 9) tells that the cell is located at the \& 10th position in the 5th row of the 3rd table of the document. \& \& In scalar context, this method returns nothing more than the first \& element of the triplet, i.e. the zero\-based position of the table \& in the order of the document. However, if the real need is to retrieve \& the table element itself, $cell\->parent\->parent is more efficient. \& \& This method produces a warning and returns undef if the argument is \& not a table cell. \& \& Caution: getCellPostion(), like any other accessor using object \& coordinates related, works only with normalized tables. .Ve .PP \fIgetCellValue(table, row, column)\fR .IX Subsection "getCellValue(table, row, column)" .PP \fIgetCellValue(cell)\fR .IX Subsection "getCellValue(cell)" .PP .Vb 3 \& Returns the value of a table cell, if the cell is defined and \& uncovered. Caution, in order to get the cell element itself for \& further processing, use getCell() instead. \& \& The first form indicates a cell by its 3D coordinates, as with \& getCell(). \& \& The second form (quicker) takes a cell element as its only argument \& (e.g. as returned by a previous getCell call). \& \& This method behaves in two different ways depending on the cell \& type. The displayable text of the cell is regarded as the cell value \& if the cell type is \*(Aqstring\*(Aq. If the cell type is one of the possible \& numeric types (\*(Aqfloat\*(Aq, \*(Aqcurrency\*(Aq, \*(Aqdate\*(Aq), the returned value is the \& internal, numeric value. \& \& This difference in handling is designed to allow programs to use \& returned numeric values directly in calculations. \& \& See also cellValueType(). \& \& Note: To get information about a cell other than its value or value \& type (numeric, etc.), the best way is first to get its element \& reference with getCell() and then use it with getAttribute. .Ve .PP \fIgetChapterContent(heading [, options])\fR .IX Subsection "getChapterContent(heading [, options])" .PP .Vb 4 \& This method returns the list of the elements depending (from the \& end\-user\*(Aqs point of view) on a given heading element, not including \& the heading element itself. The argument and the options are the \& same as with getHeading(). \& \& Examples: \& \& my @list = $doc\->getChapterContent(2, level => 3); \& foreach my $element (@list) \& { \& my $text = $doc\->getText($element); \& print "$text\en"; \& } \& \& The code above selects and prints all the text elements below the \& third level 3 heading of the document (not including the content of \& the header itself. The following example creates a new section whose \& content is made of a heading and the content of the depending chapter \& (the heading text is used as the section name): \& \& my $heading = $doc\->getHeading(2, level => 3); \& my $heading_text = $doc\->getFlatText($heading); \& my $section = $doc\->appendSection($heading_text); \& my @content = $doc\->getChapterBodyElements($heading); \& $doc\->moveElementsToSection($section, $heading, @content); \& \& (See appendSection(), getHeading(), moveElementsToSection() in the \& present manual chapter, and getFlatText() in OpenOffice::OODoc::XPath) \& \& Caution, this method returns a list of elements and not an element. \& Chapters, unlike sections, are not defined in OpenDocument. So, \& getChapterContent() should be used as a possible workaround in order \& to isolate a logical set of content elements which is not packaged in \& a section. .Ve .PP \fIgetColumn(table, column)\fR .IX Subsection "getColumn(table, column)" .PP .Vb 4 \& Returns the element reference of the given column in the given \& table. The first argument is either the table\*(Aqs sequential number in \& the document, logical name or element reference. The second argument \& is the column\*(Aqs number in the table. Synonym: getTableColumn. \& \& Caution: The application should ensure that the area including the \& needed column is "normalized". See normalizeSheet() for details about \& table normalization. .Ve .PP \fIgetDrawPage(pos/name)\fR .IX Subsection "getDrawPage(pos/name)" .PP .Vb 1 \& For presentation and drawing documents. \& \& Returns the element reference of the given page name or position. \& \& If the argument contains an integer, the page is selected according to \& its zero\-based position. If the value is negative, the position is \& counted backwards from the end. \& \& If the argument is alphanumeric, it\*(Aqs regarded as a page name, and the \& page is selected accordingly. \& \& Caution: This method can\*(Aqt retrieve a page by name if the name \& contains numeric characters only; selectDrawPageByName() should be \& preferred to do so. .Ve .PP \fI\f(BIgetEndnoteCitationList()\fI\fR .IX Subsection "getEndnoteCitationList()" .PP .Vb 2 \& Returns the list of all the endnote citations (i.e. references to \& footnotes included in the text) contained in the document. .Ve .PP \fI\f(BIgetEndnoteList()\fI\fR .IX Subsection "getEndnoteList()" .PP .Vb 3 \& Returns the list of all the endnote body elements contained in the \& document. Should be replaced by getNoteList() with the "class" option \& set to "endnote". .Ve .PP \fI\f(BIgetFootnoteCitationList()\fI\fR .IX Subsection "getFootnoteCitationList()" .PP .Vb 2 \& Returns the list of all the footnote citations (i.e. references to \& footnotes included in the text) contained in the document. .Ve .PP \fI\f(BIgetFootnoteList()\fI\fR .IX Subsection "getFootnoteList()" .PP .Vb 3 \& Returns the list of all the footnote body elements contained in the \& document. Should be replaced by getNoteList() with the "class" option \& set to "footnote". .Ve .PP \fIgetHeading(n [, options])\fR .IX Subsection "getHeading(n [, options])" .PP .Vb 1 \& Returns the nth+1 heading element. \& \& If n is negative, headings are counted backwards from the last. \& getHeader(\-1) returns the last heading element of the document. \& \& The only one possible option is "level". It allows the application \& to select the nth+1 heading element for a given level. \& \& Example: \& \& my $heading = $doc\->getHeading(2, level => 3); \& \& selects the third level 3 heading in the whole document. \& \& See also getChapterContent(). \& \& Caution: without the "level" option, this method counts sequentially \& through all headings along a single plane, irrespective of their \& level. E.g. if you have a level 1 heading then two level 2 headings \& then a level 1 heading, the call getHeading(3) returns the last \& level 1 heading. .Ve .PP \fIgetHeadingList([level => value])\fR .IX Subsection "getHeadingList([level => value])" .PP .Vb 2 \& Returns a list of heading elements (i.e. elements called \*(Aqtext:h\*(Aq in \& the document body). \& \& If the "level" option is provided, the list is restricted to the \& headings having the given level. .Ve .PP \fIgetHeaderRow(table [, row_number])\fR .IX Subsection "getHeaderRow(table [, row_number])" .PP .Vb 1 \& See getTableHeaderRow(). .Ve .PP \fIgetHeadingText(n)\fR .IX Subsection "getHeadingText(n)" .PP .Vb 2 \& Returns the text of the nth+1 heading element. Elements are counted \& in the same way as for getHeading(). .Ve .PP \fI\f(BIgetHeadingTextList()\fI\fR .IX Subsection "getHeadingTextList()" .PP .Vb 1 \& Returns a list of document heading texts. \& \& In a list context, the result is returned in the form of a list of \& character strings. In a scalar context, the result is a single \& string in which the headings are separated by a line\-break character \& ("\en"). \& \& Note: This list is "flat". It contains no information about the \& headings\*(Aq hierarchy. To get a hierarchical contents list, you must \& start with the list of headings obtained using getHeadingList and \& check each element\*(Aqs level attribute (\*(Aqtext:level\*(Aq). .Ve .PP \fIgetItemElementList(list)\fR .IX Subsection "getItemElementList(list)" .PP .Vb 5 \& Returns a list of elements which represent items of an ordered or \& unordered list. The argument is a "list" element (obtained \& previously e.g. using getItemList, getOrderedList or \& getUnorderedList). Each element in this list can be used with item \& handling methods. .Ve .PP \fIgetItemList(n)\fR .IX Subsection "getItemList(n)" .PP .Vb 2 \& Returns the element which represents the nth+1 list in a document \& if found. \& \& WARNING: In the OpenOffice.org 1 documents, only "ordered lists" and \& "unordered lists" can be present. In the Open Document format, there \& are generic list objects only, and each one is made "ordered" or \& "unordered" by its style. So, this method will never return anything \& from an OOo 1 document. .Ve .PP \fIgetLevel(element)\fR .IX Subsection "getLevel(element)" .PP .Vb 1 \& See getOutlineLevel(). .Ve .PP \fIgetList(n)\fR .IX Subsection "getList(n)" .PP .Vb 1 \& See getItemList(). .Ve .PP \fIgetListItem(list, n)\fR .IX Subsection "getListItem(list, n)" .PP .Vb 1 \& Returns the nth+1 item in a given list if found. \& \& The list (1st argument) may be given either by its order number in \& the document, or directly as an element reference. .Ve .PP \fI\f(BIgetNoteCitationList()\fI\fR .IX Subsection "getNoteCitationList()" .PP .Vb 1 \& For OpenDocument only (doesn\*(Aqt work on old OpenOffice.org documents). \& \& Returns the list of all the note citation elements (whatever their \& note class, i.e. "endnote" or "footnote"). .Ve .PP \fIgetNoteClass(note_element)\fR .IX Subsection "getNoteClass(note_element)" .PP .Vb 3 \& Returns the class of the given note element. Possible values are \& presently "endnote" and "footnote". Returns undef unless the given \& element is a note. .Ve .PP \fIgetNoteElement(class => \f(CI$note_class\fI, citation => \f(CI$note_citation\fI)\fR .IX Subsection "getNoteElement(class => $note_class, citation => $note_citation)" .PP .Vb 2 \& Returns the first note element matching the given class and citation, \& if any. Returns undef if the target note element doesn\*(Aqt exist. \& \& The "class" parameter is either "endnote" or "footnote". \& \& The "citation" parameter is the numeric or literal which refers to \& the note, as it\*(Aqs visible for the end user. \& \& Caution: The uniqueness of a note citation in a given note class is \& not a general rule. The citation is an identifier when it belongs to \& an ordered sequence (such as 1, 2, 3... or "i", "ii", "iii"...). But \& the author is allowed to use the same citation (ex: an asterisk) for \& more than one footnote or endnote. In such a situation, the method \& returns the first note matching the given citation and the given \& class. As a consequence, the note identifier, if known, is a better \& option (see the second form of getNoteElement()). .Ve .PP \fIgetNoteElement(id => \f(CI$note_identifier\fI)\fR .IX Subsection "getNoteElement(id => $note_identifier)" .PP .Vb 2 \& Returns the note element matching the given internal note identifier \& (which is a "text:id" attribute according to the ODF specification). \& \& This internal identifier is unique, whatever the note class, so the \& "class" parameter is not needed. However, "class" may be provided as \& an additional filter; if so, the method will return undef if the \& element matching the identifier doesn\*(Aqt match the class. .Ve .PP \fI\f(BIgetNoteElementList()\fI\fR .IX Subsection "getNoteElementList()" .PP .Vb 1 \& Returns the list of the endnote and footnote main elements. .Ve .PP \fI\f(BIgetNoteList()\fI\fR .IX Subsection "getNoteList()" .PP .Vb 1 \& Returns the list of the endnote and footnote body elements. .Ve .PP \fIgetOrderedList(n)\fR .IX Subsection "getOrderedList(n)" .PP .Vb 2 \& Returns the element which represents the nth+1 ordered list in a \& document if found. \& \& WARNING: Ordered lists are possible in the OpenOffice.org 1 format \& only. Don\*(Aqt use it against OpenDocument. .Ve .PP \fIgetOutlineLevel(element)\fR .IX Subsection "getOutlineLevel(element)" .PP .Vb 3 \& Returns the level number of a text element, or undef if the given \& element don\*(Aqt have a level number. Every heading element should have \& a level, while ordinary text body elements should not. Example: \& \& my $level = $doc\->getOutlineLevel($element); \& if ($level) \& { \& print "There is a level $level heading\en"; \& } \& else \& { \& print "Non\-heading element\en"; \& } .Ve .PP \fIgetParagraph(n)\fR .IX Subsection "getParagraph(n)" .PP .Vb 3 \& Returns the nth+1 paragraph in the document body, or undef if the \& given number is greater than or equal to the total number of \& paragraphs in the document. \& \& You can also pass a negative argument, in which case paragraphs are \& counted backwards from the end (\-1 being the last paragraph). \& \& By paragraphs we mean \*(Aqtext:p\*(Aq elements, which excludes headers but \& includes non\-empty table cells, contents of list items and \& footnotes. \& \& Returned value is an element and not the text of the paragraph. All \& read/write operations involving attributes and content can use this \& element. .Ve .PP \fI\f(BIgetParagraphList()\fI\fR .IX Subsection "getParagraphList()" .PP .Vb 2 \& Returns a list of paragraph elements (i.e. \*(Aqtext:p\*(Aq elements in the \& document body). .Ve .PP \fIgetParagraphText(n)\fR .IX Subsection "getParagraphText(n)" .PP .Vb 2 \& Returns the text of the nth+1 paragraph, counted using the same \& rules as for getParagraph. .Ve .PP \fIgetParagraphTextList([filter])\fR .IX Subsection "getParagraphTextList([filter])" .PP .Vb 2 \& Returns a list of texts contained in the paragraphs of a document \& (\*(Aqtext:p\*(Aq elements). \& \& A filter can be passed as an optional argument (literal or regular \& expression). In this case, only paragraph texts whose content match \& the filter are returned. \& \& In a list context, the result is returned in the form of a list of \& character strings. In a scalar context, the result is a single \& string in which the paragraphs are separated by a line\-feed \& character ("\en"). .Ve .PP \fIgetRow(table, row_num)\fR .IX Subsection "getRow(table, row_num)" .PP .Vb 4 \& Returns the element reference which corresponds to a row in a table. \& The first argument is either the table\*(Aqs sequential number in the \& document, logical name or element reference. The second argument is \& the row number in the table. Synonym: getTableRow. \& \& This methods ignores the table header (if any). It can retrieve a \& row in the table body only. See getTableHeaderRow(). .Ve .PP \fIgetRowCells(table, row)\fR .IX Subsection "getRowCells(table, row)" .PP \fIgetRowCells(row)\fR .IX Subsection "getRowCells(row)" .PP .Vb 3 \& Returns the list of the uncovered cell elements corresponding to a \& given table row. The row can be provided either by table ID and row \& number or by direct row object. .Ve .PP \fIgetSection(name/number)\fR .IX Subsection "getSection(name/number)" .PP .Vb 3 \& If the first argument is a number, returns the nth+1 section in a \& document (section numbers are zero\-based; if the argument is negative, \& the sections are counted from the end). \& \& The second form allows you to select a section by its logical name (as \& it would appear to the end user when editing the section\*(Aqs \& properties). This name is obviously easier to use than a number. \& Moreover, this type of selection means the application will still \& work even if a section changes position within a document. \& \& The returned object is a "handle" that can be used for subsequent \& element creations or retrievals in the selected section. .Ve .PP \fIgetSpanList([context])\fR .IX Subsection "getSpanList([context])" .PP .Vb 6 \& Returns a list of elements, in the given context, which correspond \& to texts which "stand out" from the regular flat text, i.e. which have \& been given a style which makes them stand out from the rest of the \& paragraph containing them. The context may be a paragraph, a section, \& or any other text container. The context argument is optional; the \& default context is the whole document. \& \& For example, a word in italics or in font size 12 in a paragraph of \& mostly standard characters in font size 10 is a \*(Aqspan\*(Aq element and \& would therefore appear in a list returned by getSpanList(). .Ve .PP \fIgetSpanTextList([filter])\fR .IX Subsection "getSpanTextList([filter])" .PP .Vb 3 \& Gets a list of texts which "stand out" in the same way as \& getSpanList() and returns it under the same conditions as \& getParagraphTextList() or getHeadingTextList(), with optional filter. .Ve .PP \fIgetStyle(path, position)\fR .IX Subsection "getStyle(path, position)" .PP \fIgetStyle(element)\fR .IX Subsection "getStyle(element)" .PP .Vb 1 \& Obsolete. See textStyle(). .Ve .PP \fIgetTable(number_or_name [, 'normalize'])\fR .IX Subsection "getTable(number_or_name [, 'normalize'])" .PP \fIgetTable(number_or_name [, length, width])\fR .IX Subsection "getTable(number_or_name [, length, width])" .PP .Vb 3 \& Returns the reference of a table, selected by name or number, in a \& scalar context. In an array context, returns the table size, like \& getTableSize(). \& \& This method works with spreadsheets as well as with tables included \& in other documents. \& \& If the first argument is a number, returns the nth+1 table in a \& document (table numbers are zero\-based; if the argument is negative, \& the tables are counted from the end). If it\*(Aqs a string, the table is \& selected by its its logical name (as it would appear to the end user \& when editing the table\*(Aqs properties). This name is obviously easier \& to use than a number. Moreover, this type of selection means the \& application will still work even if a table changes position within \& a document. But the retrieval by name works with two restrictions: \& \& \- if a table name is made of digits only, or if if represents a \& numeric expression, it\*(Aqs automatically regarded as a table number and \& the table is selected according to its sequential (zero\-based) \& position in the document; if (and only if) the given number is greater \& than the position of the last table, the given argument is regarded as \& a name (for example, if the document contains 3 tables, getTable(365) \& will attempt to retrieve a table whose name is "365"); in order to \& avoid any retrieval by number, use getTableByName(); \& \& \- getTable() can\*(Aqt retrieve a table by name if the name contains \& one or more "$", "{" or "}" characters; these characters are allowed \& in the table names in text documents (ODT), but not allowed \& in spreadsheets (ODS). \& \& The returned object is a "handle" that can be used for subsequent \& accesses to its components (rows, cells). \& \& The additional arguments, if any, instruct OODoc to normalize they \& target table in order to allow subsequent addressing of its content. \& If the "normalize" keyword is provided, the table will be fully \& normalized. If length and width arguments are provided instead, \& only an accordingly limited area, beginning at the "A1" position. \& Practically, getTable() uses normalizeSheet() in order to perform \& this job, so you should have a look at the normalizeSheet() \& documentation (in the same chapter) for explanations. \& \& Examples: \& \& my $sheet = $doc\->getTable(\*(AqChecklist\*(Aq); \& \& returns the reference of the sheet (or table) corresponding to the \& given name, without processing \& \& my $first_sheet = $doc\->getTable(0); \& my $last_sheet = $doc\->getTable(\-1); \& \& returns the references of the first and the last tables according to \& the physical order of the document \& \& ($lines, $columns) = $doc\->getTable(\*(AqFriends\*(Aq, \*(Aqnormalize\*(Aq); \& \& fully normalizes the table whose title is "Friends" and returns itself \& size. .Ve .PP \fIgetTableByName(name [, 'normalize'])\fR .IX Subsection "getTableByName(name [, 'normalize'])" .PP \fIgetTableByName(name [, length, width])\fR .IX Subsection "getTableByName(name [, length, width])" .PP .Vb 3 \& Retrieves a table according to its name (if it exists). This methods \& allows the retrieval of a table whose name is made of digits without \& possible confusion between names and numeric positions. \& \& The optional arguments and the limits are the same as for getTable(). .Ve .PP \fIgetTableCell(table, row, column)\fR .IX Subsection "getTableCell(table, row, column)" .PP \fIgetTableCell(table, coord)\fR .IX Subsection "getTableCell(table, coord)" .PP \fIgetTableCell(row, column)\fR .IX Subsection "getTableCell(row, column)" .PP .Vb 6 \& Returns the element which represents the given cell. Possible \& arguments are respectively: the table number or its reference in the \& document, row number and column number. Each table cell contained in \& the body of an OOo/ODF document can be referenced in this \& manner, as if it belonged to a single 3D table irrespective of the \& rest of the document. \& \& If the cell is defined in the spreadsheet but covered (because of a \& cell merge), the return value is undef. In other words, this method \& doesn\*(Aqt 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 \*(Aqtable\*(Aq object \& (which can be retrieved in advance using getTable). If it\*(Aqs a number \& or a name, getTable() is automatically called by getTableCell() in \& order to convert it in a \*(Aqtable\*(Aq 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\*(Aqs 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, \*(AqB12\*(Aq); \& \& 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\*(Aqs \& 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\*(Aqt address a cell that could be displayed through the GUI \& of a typical interactive spreadsheet software but that isn\*(Aqt stored \& because it\*(Aqs 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. .Ve .PP \fIgetTableColumn(table, column)\fR .IX Subsection "getTableColumn(table, column)" .PP .Vb 1 \& See getColumn. .Ve .PP \fIgetTableHeaderRow(table [, row_num])\fR .IX Subsection "getTableHeaderRow(table [, row_num])" .PP .Vb 2 \& 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\*(Aqs 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()). .Ve .PP \fI\f(BIgetTableList()\fI\fR .IX Subsection "getTableList()" .PP .Vb 1 \& Returns a list of table elements in a document. .Ve .PP \fIgetTableRow(table, row)\fR .IX Subsection "getTableRow(table, row)" .PP .Vb 1 \& See getRow. .Ve .PP \fIgetTableRows(table)\fR .IX Subsection "getTableRows(table)" .PP .Vb 1 \& 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\*(Aqs less costly than \& a lot of successive getRow() calls. .Ve .PP \fIgetTableSize(table)\fR .IX Subsection "getTableSize(table)" .PP .Vb 3 \& 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"); .Ve .PP \fIgetTableText(n)\fR .IX Subsection "getTableText(n)" .PP .Vb 2 \& Returns the content of a table, if found, whose number or reference \& is given as an argument. If not found, returns undef. \& \& The content of each cell is extracted according to the rules of \& getCellValue. \& \& In a list context, the returned value is a 2D table with each \& element containing the corresponding cell in the document. \& \& In a scalar context, the content is returned as a single string in \& CSV format. In this case, the rows are separated by a delimiter set \& by the instance variable \*(Aqline_separator\*(Aq and the fields by the \& variable \*(Aqfield_separator\*(Aq in the OODoc::Text object. (These \& delimiters are by default "\en" and ";" respectively.) .Ve .PP \fIgetText(path, position)\fR .IX Subsection "getText(path, position)" .PP \fIgetText(element)\fR .IX Subsection "getText(element)" .PP .Vb 2 \& Exports the text contained in the given element according to the \& means appropriate to that type of element. \& \& If the \*(Aquse_delimiters\*(Aq flag is set to \*(Aqon\*(Aq (default), the content \& of each element (others than ordinary paragraphs, table cell, \& headers) is preceded and/or followed by a character string depending \& on the type of the element. This also depends on the settings given \& to the delimiter values \*(Aqbegin\*(Aq and \*(Aqend\*(Aq by the \*(Aqdelimiters\*(Aq hash. \& In a default configuration where the application has not provided \& any specific delimiters, the following delimiters are used: \& \& \- \*(Aq<<\*(Aq before and \*(Aq>>\*(Aq after sections of text highlighted within \& an element (e.g. words in bold or underlined within a paragraph \& of \*(Aqstandard\*(Aq font characters). \& \& footnote citations (in text body) are placed between square \& brackets. \& \& \*(Aq{NOTE:\*(Aq and \*(Aq}\*(Aq for the content of footnotes. \& \& (Footnotes are physically inserted into the text at the place \& where they are called, just after the link element indicating the \& footnote\*(Aqs number. Its display at the foot of the page or elsewhere \& is a trick of the graphical interface.) \& \& An application can change these delimiters, add more for other types \& of elements (e.g. paragraphs, headers, tables cells, etc.), or \& deactivate them using outputDelimitersOff. This depends on where the \& text is exported to e.g. display in editable "flat" format, \& conversion to non\-OpenDocument XML or a markup language other than \& XML, generating code from text, etc.. \& \& A default export (ex: "\en") terminator can be set for any element that \& is not listed in the \*(Aqdelimiters\*(Aq hash (see defaultOutputTerminator() \& above). \& \& If the element is an ordered or unordered list, the text produced is \& a concatenation of all the lines in the list, each separated by a \& line\-break in addition to any delimiters. The default line break \& character is "\en", but it can be set to any other string (including \& an empty string) through the \*(Aqline_separator\*(Aq property of the document \& object. \& \& If the element is a string table cell, getText behaves like \& getCellValue. If the cell contains more than one paragraph, the text \& produced is a concatenation of all the paragraph contents, each \& separated in the same way as list items. \& \& If the element is a table, getText behaves like getTableText. .Ve .PP \fIgetTextBoxElement(name/number)\fR .IX Subsection "getTextBoxElement(name/number)" .PP .Vb 2 \& Retrieves a text box element by its unique name or by its order \& number in the document (or in the current context). .Ve .PP \fI\f(BIgetTextContent()\fI\fR .IX Subsection "getTextContent()" .PP .Vb 1 \& Returns the text of a document, as "flat" editable text. \& \& In a list context, the content is returned as a table with one text \& element (header or paragraph) per element. \& \& In a scalar context, the content is returned as a single character \& string with each text unit (header or paragraph) separated by a \& line\-feed ("\en"). \& \& The returned text contains no style or level information, so there \& is nothing to distinguish a header from a paragraph. \& \& Same as selectTextContent(\*(Aq.*\*(Aq). .Ve .PP \fIgetTextElementList([context])\fR .IX Subsection "getTextElementList([context])" .PP .Vb 4 \& Returns the list of all the text elements, including headers, \& paragraphs and item lists, that directly belong to an optional given \& context. Without context argument, the default context is the document \& body. .Ve .PP \fIgetTopParagraph(n)\fR .IX Subsection "getTopParagraph(n)" .PP .Vb 2 \& Same as getParagraph but only considers top level paragraphs. The \& contents of lists, tables and footnotes are excluded. .Ve .PP \fIgetUnorderedList(n)\fR .IX Subsection "getUnorderedList(n)" .PP .Vb 2 \& Returns the element which represents the nth+1 unordered list in a \& document, if found. \& \& WARNING: Ordered lists are possible in the OpenOffice.org 1 format \& only. Don\*(Aqt use it against OpenDocument. .Ve .PP \fIhyperlinkURL(hyperlink [, url])\fR .IX Subsection "hyperlinkURL(hyperlink [, url])" .PP .Vb 4 \& Get/set the URL of an hyperlink element. The first argument may be \& a previously retrieved hyperlink element (see selectHyperlinkElement \& below), or the URL of an existing hyperlink. If a second argument is \& provided, it replaces the URL of the hyperlink element. \& \& With only one argument, just returns the existing URL of the link, \& or undef if the first argument doesn\*(Aqt match an existing hyperlink \& element. .Ve .PP \fIinputTextConversion(text)\fR .IX Subsection "inputTextConversion(text)" .PP .Vb 3 \& Returns the UTF8 conversion of the given text, supposed to be in \& the local character set of the document (see the \*(Aqlocal_encoding\*(Aq \& property). .Ve .PP \fIinsertColumn(table, col_num [, options])\fR .IX Subsection "insertColumn(table, col_num [, options])" .PP .Vb 1 \& Inserts a new column in an existing table at a given position. \& \& The second argument must be the number of an existing column. \& Caution: this argument must be a column number, and not a column \& element. \& \& The new column is created as a copy of the column a the given \& position. It\*(Aqs inserted before or after the existing one, according \& to an optional "position" parameter (default \*(Aqbefore\*(Aq). \& \& Caution: before using insertColumn() against a spreadsheet, the \& application should ensure that the whole rectangular area from the top \& left cell ("A1") to the last used cell of the column at the target \& position is "normalized" (see normalizeSheet() for details about the \& table normalization). .Ve .PP \fIinsertDrawPage(page/pos [, options])\fR .IX Subsection "insertDrawPage(page/pos [, options])" .PP .Vb 2 \& In a presentation or drawing document, inserts a new page before \& or after an existing page. \& \& Possible options are the same as for appendDrawPage(), with an \& additional one: \& \& position => \*(Aqbefore\*(Aq or \*(Aqafter\*(Aq (default \*(Aqbefore\*(Aq) \& \& The new page is inserted before or after the reference page, according \& to the \*(Aqposition\*(Aq option. \& \& The first argument can be a draw page element reference (recommended) \& previously returned, for example, by a previous page retrieval or \& creation method call. Alternatively, it can be a page position or \& visible name, so it\*(Aqs regarded in the same way as in getDrawPage(). \& \& Returns the new page element, or undef in case of failure. .Ve .PP \fIinsertHeading(path, position, options)\fR .IX Subsection "insertHeading(path, position, options)" .PP \fIinsertHeading(element, options)\fR .IX Subsection "insertHeading(element, options)" .PP .Vb 2 \& Same as appendHeading, but inserts the new heading before or after \& another element. \& \& Position is that of an existing element which can be another heading \& or a paragraph. Can be given by [path, position] or by element \& reference. \& \& Possible options are the same as for appendHeading, with the \& additional option \*(Aqposition\*(Aq which determines if the heading is \& inserted before or after the element at the given position. Possible \& values for this option are \*(Aqbefore\*(Aq and \*(Aqafter\*(Aq. By default, the new \& element is inserted before the given element. .Ve .PP \fIinsertItemList(path, position [, options])\fR .IX Subsection "insertItemList(path, position [, options])" .PP \fIinsertItemList(element [, options])\fR .IX Subsection "insertItemList(element [, options])" .PP .Vb 4 \& Same as appendItemList, but a new list is inserted at the given \& position. The point of insertion can be given either by the pair \& [path, position] or by element reference. Options are the same as \& for insertParagraph. .Ve .PP \fIinsertParagraph(path, position [, options])\fR .IX Subsection "insertParagraph(path, position [, options])" .PP \fIinsertParagraph(element [, options])\fR .IX Subsection "insertParagraph(element [, options])" .PP .Vb 2 \& Same as appendParagraph, but a new paragraph is inserted at the \& given position. \& \& Position is that of an existing element which can be another \& paragraph or a header. Can be given by [path, position] or by \& element reference. \& \& Options are the same as for appendParagraph, with the additional \& option \*(Aqposition\*(Aq which determines whether the paragraph is inserted \& before or after the element at the given position. Possible values \& for this options are \*(Aqbefore\*(Aq and \*(Aqafter\*(Aq. By default, the element \& is inserted before the given element. .Ve .PP \fIinsertRow(table, row [, options])\fR .IX Subsection "insertRow(table, row [, options])" .PP \fIinsertRow(row_element [, options])\fR .IX Subsection "insertRow(row_element [, options])" .PP .Vb 5 \& Inserts a new row into a table. In its first form, pass the table \& (reference, logical name or number) and the position number in the \& table. In its second form, pass the element reference of the \& existing row which is directly before or after the position where \& you want to make the insertion. \& \& By default, the new row is inserted at the position of the \& referenced row, which displaces it and the rest of the table down by \& one row position. However, you can insert it after by using the \& \*(Aqposition => after\*(Aq option. By default, the new row is an exact copy \& of the referenced row, but you can assign particular attributes to \& it in the same manner as the insertElement method of OODoc::XPath. .Ve .PP \fIinsertSection(path, position, name [, options])\fR .IX Subsection "insertSection(path, position, name [, options])" .PP \fIinsertSection(element, name [, options])\fR .IX Subsection "insertSection(element, name [, options])" .PP .Vb 3 \& Creates a new section and inserts it immediately before or after \& an existing element (paragraph, header, table). The referenced element \& can be indicated as in insertParagraph. \& \& There is a "position" option which works in the same way as with \& insertParagraph() or insertRow(). \& \& For other options, see appendSection(). For example, insertSection() \& may be used in order to insert a subdocument in a master document. .Ve .PP \fIinsertString(path, position, text, offset)\fR .IX Subsection "insertString(path, position, text, offset)" .PP \fIinsertString(element, text, offset)\fR .IX Subsection "insertString(element, text, offset)" .PP .Vb 4 \& Inserts a flat character string in a given element (whatever the type \& of element) at the given offset. If the offset is not defined, the \& text is appended to the end of the element (however, if the offset is \& provided and set to zero, the string is inserted at the beginning). .Ve .PP \fIinsertTable(path, position, name, rows, columns [, options])\fR .IX Subsection "insertTable(path, position, name, rows, columns [, options])" .PP \fIinsertTable(element, name, rows, columns [, options])\fR .IX Subsection "insertTable(element, name, rows, columns [, options])" .PP .Vb 5 \& Creates a new table and inserts it immediately before or after \& another element (paragraph, header, table). The referenced element \& can be indicated as in insertParagraph. The other arguments and \& options are the same as for appendTable with the additional option \& \*(Aqposition\*(Aq as in insertParagraph. .Ve .PP \fIinsertTableColumn(table, col_num [, options])\fR .IX Subsection "insertTableColumn(table, col_num [, options])" .PP .Vb 1 \& See insertColumn(). .Ve .PP \fIinsertTableRow(table, row [, options])\fR .IX Subsection "insertTableRow(table, row [, options])" .PP \fIinsertTableRow(row_element [, options])\fR .IX Subsection "insertTableRow(row_element [, options])" .PP .Vb 1 \& See insertRow(). .Ve .PP \fIlockSection(section [, key])\fR .IX Subsection "lockSection(section [, key])" .PP .Vb 1 \& Installs a write protection on the given section. \& \& If a second argument is provided, it\*(Aqs stored as an encrypted key \& which is associated to the write protection. Caution, it\*(Aqs not the \& key as it should be typed by the OOo end\-user. \& \& Such a write protection works only when the document is edited through \& an OpenOffice.org\-compatible desktop software. It doesn\*(Aqt prevent the \& programs using OpenOffice::OODoc from deleting or updating the \& protected sections. .Ve .PP \fImakeHeading([options])\fR .IX Subsection "makeHeading([options])" .PP .Vb 2 \& Creates a new heading element, or marks as a heading an existing \& element. \& \& Options: \& \& element => an arbitrary existing element \& \& If this option is provided, the given element is converted in place \& to a heading, whatever its original type and position. No element \& is created. \& \& Without the \*(Aqelement\*(Aq option, a new heading element is created and \& returned for later use. This element is free; it\*(Aqs not automatically \& attached somewhere in the document. For direct heading creation and \& attachment, you should prefer appendHeading() or insertHeading(). \& \& level => a numeric, positive integer value \& \& Sets the hierarchical level of the heading (remember 1 is the top \& heading level). Caution: no default value. \& \& style => the name of a convenient heading style \& \& While it\*(Aqs not mandatory, the \*(Aqstyle\*(Aq option and a properly defined \& heading style are generally required in order to allow the office \& software to really process and display the element as a heading with \& the right hierarchical level. Of course, any previously existing \& hierarchical style is reusable here. \& \& The main purpose of this method is to allow quick heading hierarchy \& creation in a "flat" document. For exemple, an application can select \& a set of flat paragraphs matching a given condition and convert each \& one in place to a heading with a given level. .Ve .PP \fImoveElementsToSection(section, list)\fR .IX Subsection "moveElementsToSection(section, list)" .PP .Vb 1 \& Moves a list of elements from any place to a section. \& \& The section may be passed by name or by element reference; it must be \& an existing one (no new section is created). \& \& The list is a set of arbitrary elements (including sections). Each one \& is cut from its previous place and appended to the section in the \& order of the list, without document consistency check. .Ve .PP \fInormalizeSheet(sheet, rows, columns)\fR .IX Subsection "normalizeSheet(sheet, rows, columns)" .PP \fInormalizeSheet(sheet, 'full')\fR .IX Subsection "normalizeSheet(sheet, 'full')" .PP .Vb 6 \& This method preprocesses a given sheet so its components (rows, \& cells) become available for all the table\-oriented methods described \& in this chapter. In some situations, this method must be used before \& any attempt to address any individual table component (column, row or \& cell). The return value is the target table object in a scalar context \& and the size (height, width) in an array context. \& \& This method works with any kind of ODF tables, whatever the containing \& document, and not only with spreadsheets. \& \& In the first form, the 2nd and 3rd arguments define the size of a \& rectangular area, beginning at the first cell ([0, 0] or "A1"), to \& be processed, in order to save time and CPU resources when the \& application needs to address objects only in the first corner of a huge \& table. \& \& The second form allows the OODoc to normalize the whole table, \& whatever the size. It\*(Aqs certainly the preferred form, as long as \& the target sheets are reasonably sized or the hardware is powerful \& enough. \& \& The processed area becomes a workspace which is safely \& addressable by any cell/row/column processing method. This \& preprocessing is sometimes required, sometimes not. For example, \& it\*(Aqs required on present OpenOffice.org Calc spreadsheets, and \& useless on present OpenOffice.org Text tables. \& \& It\*(Aqs automatically executed when getTable() is called with size \& arguments (or with the "normalize" option); therefore it\*(Aqs not always \& explicitly invoked by the applications. However, it\*(Aqs useful to know \& its purpose. \& \& The object addressing logic (which, for example, allows a program to \& directly reach a cell using its coordinates) relies on a continuous, \& regular mapping between the user\*(Aqs view and the physical XML storage \& of the tables. However, the OpenDocument specification allows any \& conforming application to map more than one table element to a \& single XML element. When two or more contiguous objects contain \& the same value and have the same style and the same data type, they \& *may* be mapped to a single XML element with a repetition attribute. \& As a consequence, the position of the appropriate XML element can\*(Aqt be \& directly calculated from the logical coordinates of the object, and \& OODoc needs to scan the table in order to get all the repetition \& attributes and calculate the real mapping. In addition, updating an \& object whose the XML corresponding element has a repetition attribute \& would automatically update all the objects mapped to the same element, \& producing unpredictable and generally wrong results. \& \& OpenOffice.org Calc systematically uses this storage optimization in \& spreadsheets, while OpenOffice.org Writer doesn\*(Aqt use it for tables in \& text documents. In Calc (sxc/ods) documents, the XML mapping of the \& whole content is "denormalized" in order to save memory: several table \& components can be mapped to a single XML element, so the XML address \& of each one can\*(Aqt be simply calculated from its logical coordinates. \& \& In order to allow the spreadsheet components to be addressed with the \& same methods as the Writer table components, normalizeSheet() \& reorganizes the XML mapping of the given sheet. \& \& Caution: The OpenDocument specification doesn\*(Aqt make any difference \& about this point between tables included in text documents and tables \& in spreadsheet\-only documents. So any ODF\-compliant application \& *could* denormalize the XML storage of any table and use the \& repetition attributes. As a consequence, normalizeSheet() *could* be \& required in the future for other documents than OOo Calc ones. \& \& This method is not (presently) always needed for tables included \& in OpenOffice.org Writer (odt/sxw) documents, because their storage is \& "normalized" (i.e. each component is mapped to an exclusive XML \& element), with the exception of the column objects. So, \& normalizeSheet() is required with these tables when the application \& needs to use a column\-focused method such as getColumn(), \& insertColumn() or deleteColumn(). \& \& 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\*(Aqs action is limited to a given area, controlled by the \& rows, columns arguments. When these arguments are not provided, the \& method uses the \*(Aqmax_rows\*(Aq and \*(Aqmax_cols\*(Aq 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\*(Aqs 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 => \*(Aqreport.ods\*(Aq); \& my $sheet = $doc\->normalizeSheet(\*(AqSheet1\*(Aq, 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(\*(AqSheet1\*(Aq, 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\*(Aqt recommend this option for tables containing thousands of rows \& by hundred of columns): \& \& $doc\->normalizeSheet(\*(AqSheet1\*(Aq, \*(Aqfull\*(Aq); \& \& This last instruction could be automatically and silently executed \& through the following one: \& \& $doc\->getTable(\*(AqSheet1\*(Aq, \*(Aqnormalize\*(Aq); \& \& 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(). .Ve .PP \fInormalizeTable(table [, rows [, columns]])\fR .IX Subsection "normalizeTable(table [, rows [, columns]])" .PP .Vb 1 \& See normalizeSheet(). .Ve .PP \fI\f(BIoutputDelimitersOn()\fI\fR .IX Subsection "outputDelimitersOn()" .PP \fI\f(BIoutputDelimitersOff()\fI\fR .IX Subsection "outputDelimitersOff()" .PP .Vb 2 \& 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 \*(Aqdelimiters\*(Aq property. .Ve .PP \fIoutputTextConversion(text)\fR .IX Subsection "outputTextConversion(text)" .PP .Vb 3 \& 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 \*(Aqlocal_encoding\*(Aq property). .Ve .PP \fIremoveBookmark(id)\fR .IX Subsection "removeBookmark(id)" .PP .Vb 1 \& See deleteBookmark(). .Ve .PP \fIremoveHeading(position [, level => level_no])\fR .IX Subsection "removeHeading(position [, level => level_no])" .PP \fIremoveHeading(element)\fR .IX Subsection "removeHeading(element)" .PP .Vb 1 \& 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). .Ve .PP \fIremoveHyperlink(path, position)\fR .IX Subsection "removeHyperlink(path, position)" .PP \fIremoveHyperlink(element)\fR .IX Subsection "removeHyperlink(element)" .PP .Vb 2 \& Removes any hyperlink contained in the given element, leaving \& in place the previously hyperlinked text. .Ve .PP \fIremoveParagraph(position)\fR .IX Subsection "removeParagraph(position)" .PP \fIremoveParagraph(element)\fR .IX Subsection "removeParagraph(element)" .PP .Vb 1 \& 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. .Ve .PP \fIremoveCellSpan($cell)\fR .IX Subsection "removeCellSpan($cell)" .PP .Vb 3 \& Removes the multi\-column, multi\-row span of a table cell. The width \& and height of the cell are reduced to one column and one row.The \& uncovered cells take the same style and data type as the reduced cell. \& \& Caution: This method works with cells that heve been expanded using \& the "number\-rows\-spanned" and "number\-columns\-spanned" OpenDocument \& attributes. The cell expansion is done this way by the cellSpan() \& method, as well as with the present version of OpenOffice.org Calc. \& But other applications (including the present version of \& OpenOffice.org Writer) can implement the cell merge using subtables \& instead of span attributes. .Ve .PP \fI\f(BIremoveSpan()\fI\fR .IX Subsection "removeSpan()" .PP .Vb 1 \& See removeTextStyleChanges(). .Ve .PP \fIremoveTextStyleChanges(path, position)\fR .IX Subsection "removeTextStyleChanges(path, position)" .PP \fIremoveTextStyleChanges(element)\fR .IX Subsection "removeTextStyleChanges(element)" .PP .Vb 4 \& Removes all the text style that apply to particular text spans in the \& paragraph or a heading provided as argument, so all the content will be \& displayed according to the text style that is defined at the paragraph \& level (font, colors, etc). \& \& Works with paragraphs or headings only. \& \& For a more drastic result, see flatten() in OpenOffice::OODoc::XPath. \& \& See also setTextSpan(). Caution: there is no symmetry between \& setTextSpan() and removeTextStyleChanges(). The first one creates one \& styled text span at a time in a given context that may be larger than \& a single paragraph. The second one removes all the styled text spans \& in the given context, but the context is a paragraph or a heading only. .Ve .PP \fIrenameSection(section, newname)\fR .IX Subsection "renameSection(section, newname)" .PP .Vb 1 \& Renames an existing section using the second argument. .Ve .PP \fIrenameTable(table, newname)\fR .IX Subsection "renameTable(table, newname)" .PP .Vb 1 \& Renames an existing table using the second argument. .Ve .PP \fIreplaceText(path, position, filter, replacement)\fR .IX Subsection "replaceText(path, position, filter, replacement)" .PP \fIreplaceText(element, filter, replacement)\fR .IX Subsection "replaceText(element, filter, replacement)" .PP .Vb 4 \& Replaces all sub\-strings which match "filter" with "replacement" in \& the text of an element (and its descendants) indicated by \& [path, position] or by reference and returns the modified text. The \& "filter" string can be an "exact" literal or a regular expression. \& \& Example: \& \& $doc\->replaceText($p, "C(LIENT|USTOMER)", $contact); \& \& replaces each occurrence of "CLIENT" and "CUSTOMER" with the content \& of the $contact variable in the paragraph $p of document $doc. \& \& The "replacement" argument can be a function reference. In which \& case, the function is called each time the string is matched, and \& the value returned by the function is used as the replacement value. \& \& sub action { \& my $arg = shift; \& my $text = shift; \& print "$arg : $text\en"; \& return "OK"; \& } \& $doc\->replaceText($p, $expression, \e&action, "Found"); \& \& displays "Found: " (where is the text retrieved) each \& time a string matches $expression and replaces this string with \& "OK". If $expression contains an "exact" string (not a regexp), then \& clearly the text displayed will always be the same string. However, \& if it happens to be a regular expression, it is in effect the text \& retrieved which will be displayed. \& \& Generally speaking, if the replacement value is a function \& reference, the called function receives the remainder of the \& arguments which follow it, in this order: \& \& 1) all the arguments following the function reference in the \& replaceText() call, in the same order; \& \& 2) the string that matches the filter argument. \& \& See also substituteText(), which should be preferred in most \& situations. .Ve .PP \fIrowStyle(row_element [, style])\fR .IX Subsection "rowStyle(row_element [, style])" .PP \fIrowStyle(table, row [, style])\fR .IX Subsection "rowStyle(table, row [, style])" .PP .Vb 2 \& Reads or modifies a table row\*(Aqs style, in the same way as \& columnStyle does for columns. .Ve .PP \fIsectionProtectionKey(section)\fR .IX Subsection "sectionProtectionKey(section)" .PP .Vb 2 \& Returns the encrypted key which is associated to the given section, \& if the section is write\-protected by key. \& \& This method can\*(Aqt provide the real key (as it should be typed by \& the end\-user to unlock the section), but the returned value may be \& reused in order to protect more than one section with the same \& password. \& \& See also unlockSection(). .Ve .PP \fIsectionStyle(section, [newstylename])\fR .IX Subsection "sectionStyle(section, [newstylename])" .PP .Vb 1 \& Without argument, returns the current style of a given section. \& \& If an argument is provided, it becomes the new style of the section. .Ve .PP \fIselectDrawPageByName(name)\fR .IX Subsection "selectDrawPageByName(name)" .PP .Vb 2 \& In a presentation or drawing document, returns the page element \& identified by the given name, or undef if the name is unknown. \& \& The names to be used correspond to the displayed page names in \& OpenOffice.org Impress. .Ve .PP \fIselectElementByBookmark(name)\fR .IX Subsection "selectElementByBookmark(name)" .PP .Vb 1 \& Returns the element containing the given bookmark. \& \& Caution: this method works with position bookmarks only, not with \& range bookmarks (a range bookmark can be spread over several text \& elements). .Ve .PP \fIselectElementByContent([context,] filter [...])\fR .IX Subsection "selectElementByContent([context,] filter [...])" .PP .Vb 3 \& Returns the first text element whose content matches the \*(Aqfilter\*(Aq \& (which can be an exact string or a regular expression), or undef \& if no matching content is found. \& \& With additional arguments after the filter, this method can be used for \& replacement operations, or user\-defined function triggering, in the same \& conditions as selectElementsByContent(). \& \& The retrieval functionality of selectElementByContent() is the same \& as selectElementsByContent(). See selectElementsByContent() for \& limits. .Ve .PP \fIselectElementsByContent([context,] filter)\fR .IX Subsection "selectElementsByContent([context,] filter)" .PP \fIselectElementsByContent([context,] filter, replacement)\fR .IX Subsection "selectElementsByContent([context,] filter, replacement)" .PP \fIselectElementsByContent([context,] filter, action [, other_arguments])\fR .IX Subsection "selectElementsByContent([context,] filter, action [, other_arguments])" .PP .Vb 4 \& This method returns the text elements whose content matches the search \& criteria contained in \*(Aqfilter\*(Aq (a string that may be a regexp). \& Note that this method can be used with a "non\-filtering" regular \& expression (".*") for unconditional movement through all text elements. \& \& The default scope is the current context (practically it\*(Aqs the whole \& document unless it has been changed using the currentContext() method). \& However a context element may provided before the filter argument in \& order to restrict the search space. \& \& Be careful: if the search is successful, the returned elements may be \& of various kinds; they are not always paragraphs or headings. They \& may be, for example lower level text elements contained in paragraphs, \& such as text spans or text hyperlinks. \& \& The first form simply returns the given list without modifying the \& text. \& \& The second form returns the same list, but replaces all strings \& which match the search criteria with the \*(Aqreplacement\*(Aq string as it \& goes. \& \& The third form, where the \*(Aqaction\*(Aq argument is a program function \& reference, launches the given function each time the filter string \& is matched. If defined, the value returned by the function is used \& as the replacement value. If the function returns a null value \& (undef) then no replacement is made. If it returns an empty string, \& the retrieved text is deleted. The called function receives the rest \& of the arguments, in this order: \& \& 1) all remaining arguments after \*(Aqaction\*(Aq (\*(Aqother_arguments\*(Aq), if any. \& \& 2) the element containing the retrieved text. \& \& 3) the string actually selected. If the filter is an exact string, \& it is equal to the filter. If the filter is a regular expression, \& it matches the "real" text retrieved. \& \& The returned text (if any) must be encoded in UTF8. \& \& The returned list is the same one returned by the first two forms. \& \& Example: \& \& sub action \& { \& my ($d, $element, $value) = @_; \& if ($value < 100) \& { \& $d\->removeElement($element); \& return undef; \& } \& else \& { \& return $value * 2; \& } \& } \& @list = \& $doc\->selectElementsByContent("[0\-9]+", \e&action, $doc); \& \& In the above code, the subroutine "action" is called each time an \& integer (one or more digits) is found. The subroutine receives the \& document reference itself as its first argument (an OODoc::Text \& object given by the application). Next, it automatically receives \& the reference of the element in which the search string was found \& (i.e. an integer) and, finally, it receives the exact number found \& as its second\-last and last arguments respectively. If this number \& is less than 100, the element is removed. This is why the subroutine \& needed the $doc object, used to invoke the removeElement method. If \& more than 100, the number is multiplied by two and the result \& replaces the original value in the element. The list returned by \& selectElementsByContent contains all elements which contain the \& search string, including any which might have been removed by the \& called function while it was running. \& \& It is the "main" elements containing strings which matched the \& filter which are returned and not any of their sub\-elements. For \& example, if the returned string is found in one of the items in an \& unordered list, the list element is selected and not the item. \& Similarly, the table is selected when one of its cells matches the \& filter, and the paragraph which is selected when the search string \& is found in an attached footnote. \& \& Important limit: This method can\*(Aqt retrieve elements whose display \& content apparently matches the given filter but whose internal \& storage doesn\*(Aqt. For example, a paragraph containing "foo bar" will \& never be selected through selectElementByContent() if "foo" and "bar" \& have different text styles. In the same way, a substring containing \& multiple successive whitespaces will never match, because, according \& to the ODF standard, multiple spaces (like tabs or line breaks) are \& stored as special XML element instead of flat text. A character string \& cannot be considered to match the filter unless it is entirely within \& the same sub\-element and all its characters have the same style. More \& generally, a substring can match the filter if and only if it\*(Aqs \& represented with only one style and if it doesn\*(Aqt contain multiple \& spaces, tab stops or line breaks. .Ve .PP \fIselectHyperlinkElement(url_filter)\fR .IX Subsection "selectHyperlinkElement(url_filter)" .PP .Vb 2 \& Retrieves the first hyperlink element (if any) whose the URL matches \& the argument. Example: \& \& my $e = $doc\->selectHyperlinkElement("cpan"); \& \& could return an hyperlink element containing "www.cpan.org" as \& well as "search.cpan.org", etc. The URL filter is processed as \& a regexp. \& \& Note: In order to get the text container (ex: paragraph) where the \& hyperlink is located, the application can use the parent() element \& method. Example: \& \& my $e = $doc\->selectHyperlinkElement("www.cpan.org"); \& my $p = $e\->parent if $e; .Ve .PP \fIselectHyperlinkElements(url_filter)\fR .IX Subsection "selectHyperlinkElements(url_filter)" .PP .Vb 2 \& Returns the list of the hyperlink elements whose the URL matches \& the argument (and not only the first one). .Ve .PP \fIselectParagraphByStyle(stylename)\fR .IX Subsection "selectParagraphByStyle(stylename)" .PP .Vb 1 \& Returns the first paragraph (if any) using the given style. .Ve .PP \fIselectParagraphsByStyle(stylename)\fR .IX Subsection "selectParagraphsByStyle(stylename)" .PP .Vb 1 \& Returns the list of the paragraphs using the given style. .Ve .PP \fIselectTextContent(filter)\fR .IX Subsection "selectTextContent(filter)" .PP \fIselectTextContent(filter, replacement)\fR .IX Subsection "selectTextContent(filter, replacement)" .PP \fIselectTextContent(filter, action [, other_arguments])\fR .IX Subsection "selectTextContent(filter, action [, other_arguments])" .PP .Vb 2 \& Returns a list of header texts and/or paragraphs (in the document\*(Aqs \& own order) which match the given search criteria. \& \& The filter can be an exact string or a regular expression. A filter \& set to ".*" (no selection) will result in an export of the entire \& text. \& \& In all three forms, this method behaves like \& selectElementsByContent, except that it returns text instead of a \& list of elements. \& \& Depending on the context (list or scalar), the result is returned in \& the form of a list of rows or in the form of a single character \& string where the elements are separated by a line\-feed ("\en"). \& \& Note: called with a "non\-filtering" regular expression, this method \& will result in a "flat" export of the document: \& \& print $doc\->selectTextContent(\*(Aq.*\*(Aq); .Ve .PP \fIsetAnnotation(element [, options])\fR .IX Subsection "setAnnotation(element [, options])" .PP .Vb 1 \& Creates and inserts an annotation in a given element. \& \& The possible options are: \& \& \*(Aqdate\*(Aq => the date/time of the annotation (ISO\-8601 format); the default \& is the current system date/time \& \& \*(Aqauthor\*(Aq => the name of the author of the annotation; unless this \& option is provided; the default is the current system user name \& \& \*(Aqtext\*(Aq => the text content of the annotation (no default) \& \& \*(Aqstyle\*(Aq => a paragraph style for the annotation (no default) \& \& \*(Aqoffset\*(Aq => an integer value that specifies the position of the \& insertion point of the annotation (default=0); a negative value means \& that the position is counted backward from the end \& \& \*(Aqbefore\*(Aq => a regular expression; specifies that the insertion point \& should be before the first match \& \& \*(Aqafter\*(Aq => same as \*(Aqbefore\*(Aq but the insertion point should be after the \& first match \& \& \*(Aqreplace\*(Aq => same as \*(Aqbefore\*(Aq, but the matching substring is deleted \& and replaced by the annotation \& \& If \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq or \*(Aqreplace\*(Aq (which are mutually exclusive) is set, \& the \*(Aqoffset\*(Aq option, if provided too, specifies a search space \& restriction and a search way. If \*(Aqoffset\*(Aq is positive, the search space \& runs from \*(Aqoffset\*(Aq to the end; if \*(Aqoffset\*(Aq is negative, the search space \& runs from the end and its size is the absolute value of \*(Aqoffset\*(Aq. \& \& If \*(Aqoffset\*(Aq is 0, then it\*(Aqs possible to force the search backward from \& the end to the beginning using an additional \*(Aqway\*(Aq parameter whose \& possible values are \*(Aqbackward\*(Aq and \*(Aqforward\*(Aq (if \*(Aqway\*(Aq is \*(Aqbackward\*(Aq, \& then \*(Aqoffset\*(Aq is regarded as negative whatever its sign). \& \& Note that the \*(Aqcapture\*(Aq option doesn\*(Aqt work with annotations. \& \& Returns the reference of the annotation element. Note that this \& reference could be used later as a context for additional insertions \& (for example in order to append several paragraphs to the content of \& the annotation). .Ve .PP \fIsetBibliographyMark(element, [, position_options][attributes])\fR .IX Subsection "setBibliographyMark(element, [, position_options][attributes])" .PP .Vb 1 \& Creates a new bibliography mark within a given text element. \& \& The content of the new bibliography entry may be initialized through \& a \*(Aqattributes\*(Aq parameter whose value is a hash. \& \& All the possible attributes of an ODF\-compliant bibliography entry, \& such as author, editor, isbn, title, year, and many others, are \& allowed. A \*(Aqidentifier\*(Aq parameter is mandatory in order to get a \& visible mark; note that this identifier is bibliography\-specific and \& is not the same as the generic identifier that could be get or set \& using getIdentifier() and setIdentifier(). Other attributes are optional \& (but, of course, an entry with nothing more than an identifier would not \& be very useful in a final document). \& \& By default, the object is inserted at the beginning of the target text \& element. But, thanks to the optional position parameters, it can be put \& anywhere within the text of the bookmarked element. The position \& parameters are \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq and \& they work like with setAnnotation(). \& \& $para = $doc\->selectElementByContent("ODF\-related book"); \& $doc\->setBibliographyMark ( \& $para, \& offset => \-20, \& replace => "reference needed", \& attributes => { \& identifier => "JDE", \& title => "OASIS OpenDocument Essentials", \& author => "J. David Eisenberg", \& year => 2005, \& isbn => "1\-4116\-6832\-4" \& } \& ); \& \& This sequence replaces a "reference needed" substring in a given \& paragraph by a bibliography mark that will be displayed by default as \& "[JDE" and that contains various attributes. The \*(Aqreplace\*(Aq option means \& that the given substring will be deleted and replaced by the mark. The \& given (negative) offset means that the substring must be searched \& backward and that the last 20 characters of the paragraph must be \& excluded from the search space. .Ve .PP \fIsetBookmark(element, name [, position_options])\fR .IX Subsection "setBookmark(element, name [, position_options])" .PP .Vb 6 \& According to the structure of the optional parameters, this method may \& be used either to set a position bookmark (i.e. a named place holder \& at some point of the text content in a pararaph) or to set a range \& bookmark (i.e. a range of text that may spread across paragraph \& boundaries and that is delimited by a bookmark start and a bookmark end \& elements). \& \& The first form is illustrated by the following example: \& \& $doc\->setBookmark( \& $paragraph, "BM001", \& offset => \-20 \& before => "xyz" \& ); \& \& This sequence puts a bookmark identified by "BM001" in a given \& paragraph, immediately before the first "xyz" substring found in a \& backward search among the last 20 characters. \& \& The mandatory arguments are the target text element and the name of the \& new bookmark (that should be unique). \& \& By default, the object is inserted at the beginning of the text. But, \& thanks to the optional position parameters, it can be put anywhere \& within the text of the bookmarked element. The position parameters \& are \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq, and they work \& like with setAnnotation(). See also setChildElement() in OODoc::XPath. \& However, the \*(Aqtext\*(Aq option is ignored, knowing that a bookmark has no \& text content. If the \*(Aqreplace\*(Aq option is used, the matching substring \& is deleted and replaced by the bookmark, but the deleted text is not \& reused. \& \& The second form requires a bookmark name as the 1st argument, then \& a \*(Aqstart\*(Aq and a \*(Aqend\*(Aq parameters are required; each one is a hash of \& parameters that specifies the position of one mark according to the same \& options as for a position bookmark (namely with \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \& \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq). In addition, each of the \*(Aqstart\*(Aq and \& \*(Aqend hashes may contain an additional \*(Aqcontext\*(Aq parameter that specifies \& the elements that will contain the start and end marks, respectively. \& \& The following example creates a range bookmark that starts after the \& 15th character of $p1 and ends before the "xyz" substring in $p2, \& assuming that $p1 and $p2 are previously selected paragraphs in the \& right order: \& \& $doc\->setBookmark( \& "BM002", \& start => { \& context => $p1, \& offset => 15 \& }, \& end => { \& context => $p2, \& before => "xyz" \& } \& ); \& \& The user is not prevented by default from creating a range bookmark \& whose start point is after the end point of a range bookmark. However, \& it\*(Aqs possible to force an order check using a boolean \*(Aqcheck\*(Aq option. \& If \*(Aqcheck\*(Aq is \*(Aqtrue\*(Aq while the order is wrong, the bookmark is not \& created. \& \& Note that the second form of setBookmark() is the same as \& setRangeBookmark(). .Ve .PP \fIsetHyperlink(path, position, [context,] expression, url)\fR .IX Subsection "setHyperlink(path, position, [context,] expression, url)" .PP \fIsetHyperlink(element, expression, url [, options])\fR .IX Subsection "setHyperlink(element, expression, url [, options])" .PP .Vb 5 \& Puts an hyperlink on a text area in a given text element. \& The first substring matching the given "expression" argument in the \& text element (if any) will become the hyperlinked text. The "url" \& argument is, of course, the URL of the hyperlink. If successful, the \& method returns the new hyperlink element, or undef otherwise. \& \& This short example illustrates the simplest use: \& \& $doc\->setHyperlink($para, "CPAN", "http://www.cpan.org"); \& \& This method works in the same way as setTextSpan(), described below, \& but the text span is hyperlinked, and not only presented according to \& a particular style. So, the third argument must be an URL instead \& of a style. \& \& A set of hyperlink attributes may be optionally provided as a hash \& through an optional \*(Aqattributes\*(Aq parameter. For example, the application \& can provide a \*(Aqstyle\-name\*(Aq and a \*(Aqvisited\-style\-name\*(Aq as shown below: \& \& $doc\->setHyperlink ( \& $para, "CPAN", "http://www.cpan.org", \& attributes => { \& \*(Aqstyle\-name\*(Aq => "ToBeVisited", \& \*(Aqvisited\-style\-name\*(Aq => "Visited" \& } \& ); \& \& \*(Aqstyle\-name\*(Aq selects the style which applies to the text of the \& hyperlink, as long as the URL is not visited, while \& \*(Aqvisited\-style\-name\*(Aq indicates, of course, the style in use if the \& link location was already visited. These styles must belong to the \& \*(Aqtext\*(Aq family. \& \& Other allowed hyperlink attributes are listed in the §5.1.4 of the \& OASIS OpenDocument specification. They may be set through the \& \*(Aqattributes\*(Aq options or later through the common setAttributes() method \& (that may apply to the object returned by setHyperlink). \& \& Note: The hyperlink is not always a remote URL, such as in the \& example above. Internal references ere allowed as well. An \& internal reference is prefixed by "#". If an internal reference \& is a heading, it\*(Aqs prefixed by "#" and suffixed by "|outline". \& An hyperlink may be aimed at a location inside another document; \& such a link is the concatenation of a file path, a "#", and a local \& name that makes sense in the target document (bookmark, heading...). .Ve .PP \fIsetIndexMark(element, id [, options][, start =>{}, end =>{}])\fR .IX Subsection "setIndexMark(element, id [, options][, start =>{}, end =>{}])" .PP .Vb 3 \& Creates an alphabetical index entry in a given element. The first \& arguments are the target element (generally a paragraph) and a \& mandatory identifier (that should be unique). \& \& A \*(Aqtype\*(Aq parameter allows one to select the type of index; possible \& values are \*(Aqalphabetical\-index\*(Aq or \*(Aqtoc\*(Aq (the last one stands for \& "table of contents index mark"). The default is \*(Aqalphabetical\-index\*(Aq \& (it may be wrote \*(Aqalphabetical index\*(Aq, knowing that every space is \& automatically interpreted as a \*(Aq\-\*(Aq). \& \& A \*(Aqcontent\*(Aq parameter allows one to specify an expression; the first \& substring in the element that matches this expression will become the \& indexed substring. It\*(Aqs possible to restrict the search area using a \& \*(Aqoffset\*(Aq option, a positive or negative integer; a positive value means \& that the search space runs from the beginning to the given offset; a \& negative value means that it runs backward from the end to the given \& offset. In addition, a \*(Aqway\*(Aq option whose legal values are \*(Aqforward\*(Aq or \& \*(Aqbackward\*(Aq may control the search way: if \*(Aqway\*(Aq is \*(Aqbackward\*(Aq then the \& search is done backward even if \*(Aqoffset\*(Aq is not provided, and \*(Aqoffset\*(Aq \& is regarded as negative even if it\*(Aqs provided without the minus sign. \& Unless \*(Aqoffset\*(Aq is defined and negative, the default way is \*(Aqforward\*(Aq. \& \& The code below puts an index entry, identified by "idx001" and related \& to the first match of a "xyz" expression: \& \& setIndexMark( \& $paragraph, "idx001", \& type => \*(Aqalphabetical index\*(Aq, \& content => "xyz" \& ); \& \& Note that the \*(Aqtype\*(Aq option is provided for clarity only, knowing that \& \*(Aqalphabetical\-index\*(Aq is the default. \& \& The following variant puts a TOC mark, searched backward from the end \& of a given paragraph, within a 20\-character\-long area: \& \& setIndexMark( \& $paragraph, "idx001", \& type => \*(Aqtoc\*(Aq, \& content => "xyz", \& offset => 20, \& way => \*(Aqbackward\*(Aq \& ); \& \& The same result in this second example could be obtained without the \& \*(Aqway\*(Aq option, with \-20 instead of 20 as the \*(Aqoffset\*(Aq value. \& \& A more sophisticated set or parameters may be provided in order to \& specify the beginning and the end of the index mark separately. To do \& so, \*(Aqcontent\*(Aq must be omitted and replaced by the \*(Aqstart\*(Aq and \*(Aqend\*(Aq \& parameters, each one being a hash, just like with the second form of \& setBookmark() that created a range bookmark, with a restriction: \& \& The \*(Aqstart\*(Aq and \*(Aqend\*(Aq optional parameters allows one to specify the start \& and the end positions of the index mark. Each one is a hash that may \& contain the same options as with setBookmark() described below, namely \& \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq, with the exception \& of \*(Aqcontext\*(Aq, because (unlike a bookmark) an index mark is entirely \& included in a single paragraph; its start and its end belong to the same \& context, that is specified by the first argument. \& \& The following example creates an alphabetical index mark that is \& associated to a text range running from the "xyz" substring to the end \& of the given paragraph: \& \& $doc\->setIndexMark( \& $paragraph, "idx002", \& type => \*(Aqalphabetical index\*(Aq, \& start => { \& before => "xyz" \& }, \& end => { \& offset => \*(Aqend\*(Aq \& } \& ); .Ve .PP \fIsetNote(path, position, text [, options])\fR .IX Subsection "setNote(path, position, text [, options])" .PP \fIsetNote(element [, options])\fR .IX Subsection "setNote(element [, options])" .PP .Vb 3 \& Creates and inserts a footnote or an endnote in the given element with \& the given text as the note content. Returns the new note element in \& case of success, or undef if the target element doesn\*(Aqt exist. \& \& Supported options are: \& \& \*(Aqtext\*(Aq => the text content of the note \& \& \*(Aqclass\*(Aq => specifies the display class of the now note; may be \*(Aqfootnote\*(Aq \& or \*(Aqendnote\*(Aq, default is \*(Aqfootnote\*(Aq; \& \& \*(Aqid\*(Aq => a note identifier, must be provided by the application and must \& be unique for the class (be careful, the uniqueness is not automatically \& checked and no default is provided); \& \& \*(Aqcitation\*(Aq => specifies the character string to display as note citation \& (at the place in the host element where the note is anchored); \& \& \*(Aqlabel\*(Aq => this option, if provided, means that the note should not be \& processed as automatically numbered by the printing/editing applications \& and that it should be represented by the given (arbitrary) string; if \& \*(Aqlabel\*(Aq is defined, it becomes the default value of \*(Aqcitation\*(Aq; \& \& \*(Aqstyle\*(Aq => specifies the style of the note content (should be a regular \& paragraph style). \& \& By default, the object is inserted at the beginning of the text. But, \& thanks to the optional position parameters, it can be put anywhere \& within the text of the bookmarked element. The position parameters \& are \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq and they work \& like with setAnnotation(). .Ve .PP \fIsetRangeBookmark(name, start => {options}, end => {options}, ...)\fR .IX Subsection "setRangeBookmark(name, start => {options}, end => {options}, ...)" .PP .Vb 4 \& Like the second form of setBookmark(): creates a range bookmark \& according to a mandatory name (1st argument) and position options \& provided through \*(Aqstart\*(Aq and \*(Aqend\*(Aq parameters, each one being a hash \& of options. See setBookmark() above for details. .Ve .PP \fI\f(BIsetSpan()\fI\fR .IX Subsection "setSpan()" .PP .Vb 1 \& Deprecated. \& \& See textStyle(), setTextSpan() and setTextSpans(), more powerful but \& using different options. .Ve .PP \fIsetStyle(path, position, style_name)\fR .IX Subsection "setStyle(path, position, style_name)" .PP \fIsetStyle(element, style_name)\fR .IX Subsection "setStyle(element, style_name)" .PP .Vb 1 \& Obsolete. See textStyle(). .Ve .PP \fIsetText(element, text ,[text, ...])\fR .IX Subsection "setText(element, text ,[text, ...])" .PP .Vb 3 \& Alters the setText method of OODoc::XPath, so that it can handle \& complex text elements. Please read the setText() entry in \& OpenOffice::OODoc::XPath before the present entry. \& \& If the element is a paragraph, a header or a list item (ordered or \& unordered), its content is replaced by the \*(Aqtext\*(Aq argument. Caution: \& setText() deletes and replaces the previous content of the paragraph. \& \& If the element is a table cell, this method is the same as \& updateCell. \& \& If the element is a list (ordered or unordered), the content of each \& \*(Aqtext\*(Aq argument (however many) forces the creation of a new item \& which is appended to the list (existing items remain unchanged). \& Example: \& \& $doc\->setText($element, "Peter", "Paul", "John") \& \& adds three items to the list if $element is a list. If $element is, \& for example, a paragraph, then the second argument ("Peter") becomes \& the content of the paragraph and the other arguments are ignored. \& \& If the element is a note element or a note body, the given text \& becomes the content of the note body. \& \& If the element is a section, the whole content of the section is \& deleted and replaced by a single paragraph containing the given text. \& \& For all other types of $element, setText() behaves normally as defined \& in OODoc::XPath. \& \& Note: setText(), as any other text input method, doesn\*(Aqt properly \& process repeated spaces by default. So, a sequence of spaces, whatever \& its length, is replaced by a single space. See setText() and \& extendText() in OpenOffice::OODoc::XPath. .Ve .PP \fIsetTextBoxContent(text_box, content)\fR .IX Subsection "setTextBoxContent(text_box, content)" .PP .Vb 1 \& Fills the given text box according to the given content. \& \& The first argument may be the unique name, the order number or the \& reference of a text box. The content is processed in the same way \& as the content option in createTextBox(). .Ve .PP \fIsetTextField(element, field-type [, options])\fR .IX Subsection "setTextField(element, field-type [, options])" .PP .Vb 1 \& Puts a variable text field in a given text element. \& \& The 2nd argument specifies the type of field. The offical types are \& described in §6.2 and §6.4 in the OpenDocument 1.1 specification, \& corresponding to the so\-called "document fields" and "metadata fields". \& \& Examples of possible field type arguments are \*(Aqpage number\*(Aq, \*(Aqchapter\*(Aq, \& \*(Aqparagraph count\*(Aq, \*(Aqtime\*(Aq, \*(Aqfile name\*(Aq, \*(Aqcreator\*(Aq, \*(Aqcreation date\*(Aq, etc. \& The full syntax of the ODF field tags is not mandatory; the right \& namespace prefix is automatically added if the given type indicator \& doesn\*(Aqt contain a semicolon, and every space is replaced by a \*(Aq\-\*(Aq. So, \& a field type like, say "text:word\-count" may be specified as \& "word count". \& \& This method may be used in order to display a declared user field. To \& do so, the field type must be \*(Aqvariable\*(Aq instead of a regular ODF \& text field, and a \*(Aqname\*(Aq parameter must be provided with the name of an \& existing (ot to be created) user field declaration. \& \& While the content of a text field is often computed and displayed \& dynamically by ODF\-compliant viewers, it\*(Aqs possible to provide an \& alternative text that will be persistently stored in the field and \& available for applications which are note able to compute the content \& and/or for users who need to know the last displayed value. Such an \& alternative content is provided through a \*(Aqtext\*(Aq option. \& \& It\*(Aqs possible to provide the new text field with one or more attributes \& as a hash through a \*(Aqattributes\*(Aq parameter. The most common attributes \& are \*(Aqfixed\*(Aq and \*(Aqstyle\*(Aq; the first one is a boolean, the \& second one is the name of a display format. The \*(Aqfixed\*(Aq attribute, if \& \*(Aqtrue\*(Aq, prevents the ODF\-compliant editors and viewers from refreshing \& the content of the field (for example a fixed date field displays the \& same date forever instead of the current date). The \*(Aqstyle\*(Aq attribute \& is the name of a display format (it\*(Aqs recommended to associate every \& date, time or numeric field to a display format, while the default \& display format of some ODF editors may be convenient for some needs). \& Here the \*(Aqstyle\*(Aq attribute is a shorcut for \*(Aqstyle:data\-style\-name\*(Aq; \& see the ODF 1.1 specification §6.7.7 for a full description of this \& kind of styles. \& \& Other attributes depend on the kind of content. The following example \& creates a fixed time field; the time value is stored as standard \& (ISO 8601) date format and the alternative text is an arbitrary local \& representation of the same; the presentation style (for applications \& that can deal with ODF number styles) is "MyTimeStyle" (that is supposed \& to be the name of a time style defined as an automatic style in the \& document): \& \& $doc\->setTextField ( \& $paragraph, \*(Aqtime\*(Aq, \& text => "17:03:25", \& attributes => { \& fixed => \*(Aqtrue\*(Aq, \& \*(Aqtime value\*(Aq => "2010\-02\-25T17:03:25", \& style => "MyTimeStyle" \& ); \& \& Note that in this example, if \*(Aqfixed\*(Aq was \*(Aqfalse\*(Aq or undef, a fully \& functional ODF editor could dynamically update the \*(Aqtime value\*(Aq \& according to the current date and the text content according to the \& current time and the given style. Here the internal value is a \& \*(Aqtime value\*(Aq; it would be the same for any field type containing a \& time value (such as, say, a \*(Aqprint time\*(Aq or a \*(Aqcreation time\*(Aq field). \& For other field types, the corresponding attribute would be \& \*(Aqdate value\*(Aq, \*(Aqstring value\*(Aq, \*(Aqboolean value\*(Aq, or just \*(Aqvalue\*(Aq. For \& any detailed information about the possible attribute combinations \& according to the field types, have a look at the chapter 6 of ODF 1.1. \& \& By default, the field is inserted at the beginning of the given text \& element. But, thanks to the optional position parameters, it can be put \& anywhere within the text of the element. The position parameters \& are \*(Aqoffset\*(Aq, \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq, \*(Aqreplace\*(Aq, and \*(Aqway\*(Aq, and they work \& like with setBookmark() and other methods. See also setChildElement() \& in OODoc::XPath. If the \*(Aqreplace\*(Aq option is used, the matching substring \& is deleted and replaced by the text field. The next example inserts \& the name of the author of the last change (i.e. the \*(Aqcreator\*(Aq, according \& to the ODF vocabulary) as a replacement of a "AUTHOR HERE" substring \& searched backward somewhere in a 50\-character\-long area at the end of \& the target element: \& \& $doc\->setTextField ( \& $paragraph, \*(Aqcreator\*(Aq, \& replace => "AUTHOR HERE", \& offset => 50, \& way => \*(Aqbackward\*(Aq \& ); \& \& and the code below appends after the last character of the paragraph a \& \*(Aqfile name\*(Aq field that will display the full path of the file: \& \& $doc\->setTextField ( \& $paragraph, \*(Aqfile name\*(Aq, \& offset => \*(Aqend\*(Aq, \& attributes => { \& display => \*(Aqfull\*(Aq \& } \& ); \& \& The last example creates a display area in a given paragraph after a \& given substring for a declared variable whose name is "Amount" (see \& setUserFieldDeclaration() in OpenOffice::OODoc::XPath to see how such \& a variable may be declared): \& \& $doc\->setTextField ( \& $paragraph, \*(Aqvariable\*(Aq, \& name => "Amount", \& replace => "AMOUNT HERE" \& ); .Ve .PP \fIsetTextFields(element, expression, field-type [, options])\fR .IX Subsection "setTextFields(element, expression, field-type [, options])" .PP .Vb 3 \& Replaces every substring that matches the given expression in the given \& text element by a variable text field. See textField() in the present \& manual chapter for some information about text fields. \& \& This method works the same way as setTextSpans() to retrieve the strings \& to be replaced. However, each matching string becomes invisible and \& is replaced by the variable field. \& \& Optional field attributes are allowed after the field type in the same \& conditions as for textField(). \& \& The following example replaces every occurrence of "TIMESTAMP" in a \& given section by a variable field displaying a time which is 2 hours \& later than the current time: \& \& $section = $doc\->getSection("Variables"); \& $doc\->setTextFields \& ( \& $section, "TIMESTAMP", \*(Aqtime\*(Aq, \& \*(Aqtime\-adjust\*(Aq => \*(AqPT02H\*(Aq \& ); \& \& This method returns the text field elements as a list. \& \& See also setTextField(). .Ve .PP \fIsetTextSpan(path, position, style [, options])\fR .IX Subsection "setTextSpan(path, position, style [, options])" .PP \fIsetTextSpan(element, style [, options])\fR .IX Subsection "setTextSpan(element, style [, options])" .PP .Vb 4 \& Inserts a substring with a special text style in a selected position \& within the content of an existing text element (namely a paragraph or \& a heading). Unlike setTextSpans() and the 3\-argument use of textStyle(), \& inserts only one span (or nothing if the conditions are not met). \& \& A "text span" is a substring whose presentation style differs from the \& style of the text element to which it belongs. For example, a given \& "span" could be in italics while the rest of the paragraph is in normal \& characters. A text span is a special element that contains text but that \& must be included in a paragraph or a heading. Caution: the same word has \& a different meaning when it\*(Aqs used about table cells (see cellSpan()). \& The properties of a text span can be related to any kind of character \& string presentation, such as font, font size, font weight, font \& style, and colors (background and foreground). Whatever these \& properties, they apply through a style. \& \& setTextSpan() works on any kind of text container, whatever its \& hierarchical level. For example, if the given element is a table, \& the span style attribution applies to every cell of the table. And \& the same change can be done in all the displayable content not \& including page headers, page footers, and page backgrounds through \& a single setTextSpans() call, if the given element is the document body \& itself (see getBody() in OpenOffice::OODoc::XPath). \& \& The first argument is the target element, the second one is the name of \& a text style (existing of to be defined). The optional parameters that \& follow specify how and where the text span should be inserted. \& \& The method returns the new text span object, or undef in case of \& failure. \& \& The location of the text span may be specified using the same options as \& the setChildElement() which is described in the OODoc::XPath manual. \& \& A \*(Aqcapture\*(Aq parameter, whose value is a string, means that the first \& substring that matches it should become the content of the new text \& span. The following instruction replaces the first appearance of the \& "ODF" substring in a given paragraph by a text span whose content will \& be "ODF" and whose style will be "Standout"; in other words, it tells \& that the style "Standout" will apply to the first "ODF" substring: \& \& $doc\->setTextSpan($paragraph, \*(AqStandout\*(Aq, capture => "ODF"); \& \& It\*(Aqs possible to apply a text style and to change the text content in \& a single operation using both the \*(Aqreplace\*(Aq and the \*(Aqtext\*(Aq options. \& If \*(Aqtext\*(Aq is set, its value is used as the text of the new span element. \& In the next example, the "ODF" substring will be removed and replaced \& by a text span whose style will be "Standout" and content will be \& "OpenDocument" instead of "ODF": \& \& $doc\->setTextSpan( \& $paragraph, "Standout", \& replace => "ODF", \& text => "OpenDocument" \& ); \& \& Note that there is no default text, so if \*(Aqreplace\*(Aq is set while \*(Aqtext\*(Aq \& is not set, the matching substring is deleted and replaced by a text \& span with a style but without content, resulting in useless markup \& (there are more convenient ways to just delete a substring). \& \& Practically, if both \*(Aqtext\*(Aq and \*(Aqcapture\*(Aq are set, the result is the \& same as with \*(Aqreplace\*(Aq; however, as soon as the aim is to replace a \& substring by a text span and not to capture the content of the substring \& in the text span, I encourage the use of \*(Aqreplace\*(Aq in order to get a \& more self\-documented code. \& \& It\*(Aqs possible to provide a search string with a \*(Aqafter\*(Aq or \*(Aqbefore\*(Aq \& option instead of \*(Aqreplace\*(Aq. If so, the new text span is inserted \& after of before the first match, and no text is removed or moved into \& the text span element, that may receive the value of \*(Aqtext\*(Aq (if set). \& The example below creates a text span with the "Standout" style and \& whose content is "OpenDocument" immediately after a the substring "the \& best document format is ": \& \& $doc\->setTextSpan( \& $paragraph, "Standout", \& after => "the best document format is ", \& text => "OpenDocument" \& ); \& \& While the \*(Aqreplace\*(Aq, \*(Aqafter\*(Aq or \*(Aqbefore\*(Aq parameter automatically selects \& the first match, it\*(Aqs possible to reverse the search, thanks to the \& \*(Aqway\*(Aq option, whose possible values are \*(Aqforward\*(Aq and \*(Aqbackward\*(Aq \& (default=\*(Aqforward\*(Aq). \& \& Caution: A substring located partly in a "span" and partly outside it \& will never match. In addition, while a text span is allowed inside \& another text span, a text span can not be spread across element \& boundaries. \& \& The \*(Aqoffset\*(Aq parameter is a positive or negative integer that specifies \& the start position of the span in the text. So, this parameter allows \& to insert a text span at an arbitrary position (counted forward from the \& start or backward from the end). \& \& If \*(Aqbefore\*(Aq, \*(Aqafter\*(Aq or \*(Aqreplace\*(Aq (which are mutually exclusive) is set, \& the \*(Aqoffset\*(Aq option, if provided too, specifies a search space \& restriction and a search way. If \*(Aqoffset\*(Aq is positive, the search space \& runs from \*(Aqoffset\*(Aq to the end; if \*(Aqoffset\*(Aq is negative, the start \& position is counted from the end and the search space runs backward \& from the given position and the beginning of the context. \& \& More generally, this method uses the logic and the search options of \& setChildElement() to compute the insert point, like setAnnotation() and \& other special intra\-paragraph markup insertion methods; \& setChildElement() is described in the OODoc::XPath manual page. \& \& Remember that setTextSpan() creates only one text span with various \& options; if the aim is to automatically create a text span for every \& match of a given substring, see setTextSpans() or textStyle(). .Ve .PP \fIsetTextSpans(element, style [, options])\fR .IX Subsection "setTextSpans(element, style [, options])" .PP .Vb 6 \& Applies a special text style to all the substrings of a given text \& element that match a given expression. See setTextSpan() for \& explanations about the meaning of "text span". The main difference \& with setTextSpan() is that setTextSpans() operates repeatedly so it \& may apply the given style to every substring that matches the given \& conditions. \& \& The context element and the style to apply are provided as mandatory \& arguments. They are followed by the named search parameters. These \& parameters are the same as for setTextSpan(). Warning: the user must \& ensure that the provided search parameters make sense and can\*(Aqt result \& in an infinite loop. For example, the following instruction will \& attempt to create an infinite sequence of continuous bookmarks before \& the first occurrence of "xyz" substring, if this substring exists: \& \& $doc\->setTextSpans( # Wrong ! \& $paragraph, "SomeStyle", \& before => "xyz" \& ); \& \& Taking the following paragraph as an example: \& \& "OpenOffice.org includes Writer, Calc, Draw and Impress" \& \& Assuming this text is contained in a $p element, the following \& instruction gives the "Highlight" style to the "OpenOffice.org", \& "Writer", "Calc", "Draw", and "Impress" substrings: \& \& $doc\->setTextSpans( \& $p, "HighLight", \& capture => \*(AqOpenOffice\e.org|Writer|Draw|Calc|Impress\*(Aq \& ); \& \& Note that the instruction above produces the same result as: \& \& $doc\->textStyle( \& $p, "HighLight", \& \*(AqOpenOffice\e.org|Writer|Draw|Calc|Impress\*(Aq \& ); \& \& While the 3\-argument use of textStyle() is appropriate as long as the \& aim is to unconditionally apply the given style to every matching string \& in the context, setTextSpans() allows much more selective operations. \& \& The given context may be any element, including the whole document, \& and not only a paragraph. This last example produces the same effect \& as the previous one, but it operates between two given arbitrary text \& bookmarks that may be in different paragraphs in the document, while \& the context is the document body: \& \& $doc\->setTextSpans( \& $doc\->getBody(), "HighLight", \& capture => \*(AqOpenOffice\e.org|Writer|Draw|Calc|Impress\*(Aq, \& start_mark => $doc\->getBookmark("BM1"), \& end_mark => $doc\->getBookmark("BM2") \& ); \& \& See also setTextSpan(), removeStyleChanges(), textStyle() and \& setHyperlink(). .Ve .PP \fIsetUserFieldDeclaration(name [, options])\fR .IX Subsection "setUserFieldDeclaration(name [, options])" .PP .Vb 2 \& Creates a user field declaration for the document. Allowed options \& are: \& \& \*(Aqtype\*(Aq => the data type (default=string) \& \*(Aqvalue\*(Aq => the initial value (default="") \& \& Returns the new variable element if successful. Does nothing and \& returns undef if the variable already exists. The example below creates \& a declaration for a variable whose name="Amount", type=float and \& value=1234.56 \& \& $doc\->setUserFieldDeclaration( \& "Amount", \& type => \*(Aqfloat\*(Aq, \& value => 1234.56 \& ); \& \& See also getUserField(), userFieldValue(), setTextField(). .Ve .PP \fIsubstituteText(element, filter, replacement)\fR .IX Subsection "substituteText(element, filter, replacement)" .PP .Vb 2 \& Replaces any substring in a given element and its descendants, \& matching a given filter (regexp) by a given replacement string. \& \& It "replacement" is a string, this method produces the same result as \& replaceText(), and it should be preferred. \& \& If "replacement" is a function reference, the replacement value is the \& return value of the function. But, unlike replaceText(), any argument \& after "replacement" is ignored. \& \& This method is a wrapper for the subs_text() method provided by the \& XML::Twig::Elt class. See the XML::Twig documentation for advanced \& details. .Ve .PP \fItableName(table [, newname])\fR .IX Subsection "tableName(table [, newname])" .PP .Vb 3 \& Returns the current name of a given table, or replaces it with a new \& name given as the second argument. The table can be indicated \& by number, logical name or reference. \& \& Returns undef unless the given table is defined. \& \& If the new name is the name of an existing table, the table is not \& renamed and an error message is produced. .Ve .PP \fItableStyle(table [, style])\fR .IX Subsection "tableStyle(table [, style])" .PP .Vb 3 \& Returns the current style of a given table, or replaces it with a \& new style given as the second argument. The table can be indicated \& by number, logical name or reference. .Ve .PP \fItextBoxCoordinates(text_box [, new_coord])\fR .IX Subsection "textBoxCoordinates(text_box [, new_coord])" .PP .Vb 3 \& Gets or sets the position of a text box. The new coordinates, if \& any, must be provided using the same syntax and units as with \& the "position" option in createTextBox(). .Ve .PP \fItextBoxDescription(text_box, [, new_desc])\fR .IX Subsection "textBoxDescription(text_box, [, new_desc])" .PP .Vb 2 \& Gets or sets the optional description (long label) of the given \& text box. .Ve .PP \fItextBoxName(text_box [, new_name])\fR .IX Subsection "textBoxName(text_box [, new_name])" .PP .Vb 5 \& Allows the applications to get the name of the given text box \& (which makes sense if the name is unknown, i.e. if the first \& argument is the element reference or the order number and not \& the name itself, of course). If a literal is passed as a second \& argument, the text box is renamed accordingly. .Ve .PP \fItextId(element [, text_id])\fR .IX Subsection "textId(element [, text_id])" .PP .Vb 3 \& This accessor gets or sets the "text identifier", an optional \& attribute of any text container. This attribute is presently used \& for a few elements by OpenOffice.org (ex: the notes). \& \& With one argument only, returns the existing identifier of the given \& element, or undef if the element doesn\*(Aqt own a text identifier. \& If a second argument is provided, its value replaces any previous \& value of the identifier, and the text identifier is created if needed. \& The new value is not checked, so the application should take care of \& its uniqueness. \& \& The text identifier can be used as a bookmark, knowing that, unlike a \& bookmark, this attribute is not visible for the end user. \& \& See also selectElementByTextId(). \& \& Caution: The text identifiers created or changed by other applications \& are presently *not* preserved when the document is edited through \& OpenOffice.org. .Ve .PP \fItextField(type [, options])\fR .IX Subsection "textField(type [, options])" .PP .Vb 2 \& Creates and returns a variable field to be inserted within a text \& element. \& \& Such a field doesn\*(Aqt contain any static text by itself. When \& included in a text container, it tells the editing/printing software \& to display dynamic context data, such as date, time, file name, \& page number, page count, author, etc. Variable text fields are mainly \& used in page headers or footers, but they are allowed in the page \& bodies as well. Remember that a text field must be attached as a child \& element of a text container (paragraph or heading) in order to be \& displayed. However, the text container itself may be attached to \& anything anywhere (ex: a page header, a table cell, a list item, etc). \& \& The first argument (mandatory) is the field type. Many field types \& are allowed, so they are not all listed here. For some of them, \& options are allowed or required. \& \& To get the full list of field types, and their possible options, \& look at the chapter 6 "Text fields" in the OpenDocument 1.0 \& specification. However, a few ones are presented below as examples. \& \& The field type, as well as each field option, must be provided as it \& appears in the OpenDocument specification, without the "text:" prefix \& (this prefix is automatically added). However, the application can \& force any arbitrary field name and/or field option such as \*(Aqxxx:yyy\*(Aq \& (any name or option including a \*(Aq:\*(Aq is accepted as is). \& \& Caution: textField() allows the user to create any kind of field, \& without OpenDocument compliance check. So it can be used to insert \& application\-specific markup in any place. This feature could prove \& useful in some situations, but remember that a typo in a field type \& or option will not be automatically detected. In the other hand, every \& non\-OpenDocument field is silently removed if the document is later \& edited and saved through OpenOffice.org. \& \& Knowing that the created element is not attached to a text container, \& it must be inserted or appended through another method. For example, \& the following sequence creates a paragraph displaying "This document \& contains pages and we are in the page ": \& \& $para = $doc\->appendParagraph \& ( \& text => "This document contains ", \& style => "Standard" \& ); \& $pg = $doc\->textField(\*(Aqpage\-count\*(Aq); \& $doc\->appendElement($para, $pg); \& $doc\->extendText($para, " pages and we are in the page "); \& $pg = $doc\->textField(\*(Aqpage\-number\*(Aq); \& $doc\->appendElement($para, $pg); \& \& The \*(Aqpage\-number\*(Aq field type, introduced above, could be adjusted in \& order to display the page number of any following or preceding page. \& To do so, a \*(Aqpage\-adjust\*(Aq option, set with a positive or negative \& integer value, should be provided to createField(): \& \& $pg = $doc\->textField \& (\*(Aqpage\-number\*(Aq, \*(Aqpage\-adjust\*(Aq => \-2); \& \& Note that, if the arithmetic sum of the real page number and the \& \*(Aqpage\-adjust\*(Aq value doesn\*(Aqt match an existing page, the editing \& application should display nothing. \& \& As another example, a \*(Aqchapter\*(Aq field displays the current chapter \& number or title. It requires 2 options: \*(Aqoutline\-level\*(Aq, an integer \& which selects the hierarchical heading level to be regarded as the \& chapter level, and \*(Aqdisplay\*(Aq which controls the value to display \& (chapter number, chapter name or both). The following instruction \& creates a field displaying the number and the name of the current \& level 1 heading: \& \& $chapter_field = $doc\->textField \& ( \& \*(Aqchapter\*(Aq, \& \*(Aqoutline\-level\*(Aq => 1, \& \*(Aqdisplay\*(Aq => \*(Aqnumber\-and\-name\*(Aq \& ); \& \& Other possible fields display the current date or time (see the \& setTextField() example about a time field with an optional ajustment), \& the author\*(Aqs name, the file path or name, and many other variable or \& fixed values, according to many options. .Ve .PP \fItextStyle(path, position [, style [, expression]])\fR .IX Subsection "textStyle(path, position [, style [, expression]])" .PP \fItextStyle(element [, style [, expression]])\fR .IX Subsection "textStyle(element [, style [, expression]])" .PP .Vb 3 \& Reads the name of a text element\*(Aqs style or, if a \*(Aqstyle\*(Aq argument is \& given, changes it. The text element may be a section, paragraph, a \& heading, or a text span included in a paragraph or a heading. \& \& The element can be indicated by the pair [path, position] or by \& reference. \& \& If a style is provided as the second argument, it\*(Aqs applied to the text \& element (and it replaces the previously set style, if any). \& \& If a text string is provided as the third argument, the given style \& applies to every matching substring in the element, and not to the \& element itself. In this case, the given style must be a text style, \& while it must be a paragraph style otherwise. \& \& The returned value is a literal style identifier, i.e. the value \& of the element\*(Aqs \*(Aqtext:style\-name\*(Aq attribute. This identifier could \& be used to retrieve the style element itself, through another method \& such as getStyleElement() (see OpenOffice::OODoc::Styles). \& \& In the following example, the 1st instruction just returns the current \& style of a given paragraph, the 2nd one sets the style of the given \& paragraph to "New Paragraph Style", and the 3rd applies the "New Text \& Style" to every substring matching "foo" in the given paragraph: \& \& $current_style = $doc\->textStyle($paragraph); \& $doc\->textStyle($paragraph, "New Paragraph Style"); \& $doc\->textStyle($paragraph, "New Text Style", "foo"); \& \& For more selective ways to apply a text style to a portion of paragraph, \& see setTextSpan(). .Ve .PP \fIunlockSection(section)\fR .IX Subsection "unlockSection(section)" .PP .Vb 3 \& Removes the write protection (if any) of the given section. If the \& section was key\-protected, the key is removed and provides the return \& value of the method. \& \& Example: \& \& my $key = $doc\->unlockSection("Section1"); \& $doc\->lockSection("Section2", $key); \& \& The two lines above remove the protection of "Section1" and protect \& "Section2" with the password which previously protected "Section1". .Ve .PP \fI\f(BIunlockSections()\fI\fR .IX Subsection "unlockSections()" .PP .Vb 1 \& Removes the write protection of every section in the document. .Ve .PP \fIupdateCell(table, row, column, value [, text])\fR .IX Subsection "updateCell(table, row, column, value [, text])" .PP \fIupdateCell(element, value [, text])\fR .IX Subsection "updateCell(element, value [, text])" .PP .Vb 1 \& Modifies the content of a table cell. \& \& In its first form, indicates a cell by its 3D coordinates, as with \& getTableCell(). In its second form, indicates a cell by its element \& reference. \& \& If the cell is set to literal, its content is limited to its text. \& In this case, the optional argument "text" is of no use (the text \& equals the value). \& \& If the cell is set to numeric (float, currency, date, etc.), you \& should generally pass a literal argument as well as the value. \& \& This method can be replaced by cellValue() which allows reads and \& writes. .Ve .PP \fIupdateText(element [, options])\fR .IX Subsection "updateText(element [, options])" .PP .Vb 2 \& Changes some text content in the given element or its descendants, \& according to the given options: \& \& \*(Aqtext\*(Aq: a text string that will be inserted somewhere within the \& element, at a position which depends on other options, by default at \& the beginning. \& \& Alternatively, the \*(Aqtext\*(Aq option may be a reference to a user\-provided \& function whose return value will be used as the text to be inserted; \& this function will be called with the document object as its first \& argument (so it can use document\-based methods), the current text node \& as its second argument and optionally with a text string (that depends \& on other options, see below) as its third argument. (Be careful, a \& "text run", or "text node", is not always an element; it may be a local \& text segment within an element.) The user\-provided function is not \& supposed to update the text node by itself. If the return value is \& undef, or an empty string, nothing is inserted. \& \& \*(Aqreplace\*(Aq: a search string (regex) whose first match will be deleted \& (and, of course, replaced by the value of the \*(Aqtext\*(Aq option , if any). \& \& \*(Aqafter\*(Aq: a search string (regex) whose first match will be followed by \& the new inserted text. \& \& \*(Aqbefore\*(Aq: a search string (regex) whose first march will be preceded by \& the new inserted text. \& \& Note that \*(Aqreplace\*(Aq, \*(Aqbefore\*(Aq and \*(Aqafter\*(Aq are mutually exclusive. If \& \*(Aqtext\*(Aq is set with a function reference, the corresponding function \& will be called with the matching substring as its second argument; if \& none of the allowed search string options is set, this function will be \& called with the document argument only. \& \& \*(Aqway\*(Aq: an indicator, whose allowed values are \*(Aqforward\*(Aq and \*(Aqbackward\*(Aq \& (default \*(Aqforward\*(Aq), that specifies the search way. If \*(Aqway\*(Aq is \& \*(Aqbackward\*(Aq, the provided search string (if any) is searched backward \& from the end (i.e. the first match is the last match in the order of the \& document), and the \*(Aqoffset\*(Aq is counted back from the end (note that a \& negative offset automatically switches the \*(Aqway\*(Aq to \*(Aqbackward\*(Aq). If the \& result doesn\*(Aqt depend on the search way, the \*(Aqway\*(Aq option should be \& omitted or set to \*(Aqforward\*(Aq. \& \& \*(Aqoffset\*(Aq: a numeric position that specifies the point where the content \& of the \*(Aqtext\*(Aq option will be inserted; if \*(Aqoffset\*(Aq and one of the \& allowed search strings (after, before or replace) are provided, then \& \*(Aqoffset\*(Aq specifies the limit of the search area instead of a insertion \& point; if \*(Aqoffset\*(Aq is positive and \*(Aqway\*(Aq is \*(Aqforward\*(Aq (or not set), the \& search is done from \*(Aqoffset\*(Aq to the end; if \*(Aqoffset\*(Aq is negative or \& \*(Aqway\*(Aq is \*(Aqbackward\*(Aq, the search is done backward from the given offset \& to the beginning; a negative \*(Aqoffset\*(Aq means a backward \*(Aqway\*(Aq (but if \& \*(Aqway\*(Aq is \*(Aqbackward\*(Aq, the sign of \*(Aqoffset\*(Aq is ignored, in order to avoid \& useless complications). \& \& \*(Aqrepeat\*(Aq: if set to \*(Aqtrue\*(Aq, specifies that the action must be done \& repeatedly in a way that depends on the other options. If \*(Aqrepeat\*(Aq is \& set to \*(Aqtrue\*(Aq while none of the search string options (after, before or \& replace) is set, the result depends on the \*(Aqoffset\*(Aq. If \*(Aqoffset\*(Aq is 0 \& or undef, then the \*(Aqrepeat\*(Aq option is ignored (avoiding an infinite \& loop!). If only \*(Aqoffset\*(Aq and \*(Aqtext\*(Aq are provided, the new text is \& repeatedly inserted with \*(Aqoffset\*(Aq as the interval. \& \& Note: for repetitive and unconditional text replacements in a given \& context (i.e. when no parameter other than the context, the search \& filter and the replacement string is required), substituteText() should \& be preferred (see substituteText() in OODoc::XPath). \& \& The following example replaces the last match of "old" by "new" in a \& given paragraph: \& \& $doc\->updateText( \& $paragraph, \& replace => "old", \& text => "new", \& way => \*(Aqbackward\*(Aq \& ); \& \& The same, but the replacement is done for the whole paragraph (note that \& the \*(Aqway\*(Aq option is omitted, knowing that in such situation the result \& will be the same whatever the search way, so \*(Aqforward\*(Aq is OK): \& \& $doc\->updateText( \& $paragraph, \& replace => "old", \& text => "new", \& repeat => \*(Aqtrue\*(Aq \& ); \& \& The next instruction makes sure that "Smith" becomes "Mr. Smith" \& everywhere between the bookmarks "BM1" and "BM2" (because such a space \& may spread over various and multiple elements, the whole document body \& is specified as the search context instead of a paragraph): \& \& $doc\->updateText( \& $doc\->getBody, \& before => "Smith", \& text => "Mr. ", \& start_mark => $doc\->getBookmark("BM1"), \& end_mark => $doc\->getBookmark("BM2"), \& repeat => \*(Aqtrue\*(Aq \& ); .Ve .PP \fIupdateUserFieldReferences(user_field [, context])\fR .IX Subsection "updateUserFieldReferences(user_field [, context])" .PP .Vb 2 \& Forces an immediate update of the display representation(s) of \& a given user field, according to the actual value of the field. \& \& It\*(Aqs possible to restrict the scope to a particular context, that \& may be provided as an optional argument. .Ve .SS "OpenOffice::OODoc::Element methods" .IX Subsection "OpenOffice::OODoc::Element methods" .Vb 6 \& While all the methods above belong to the document object, some \& additional methods are defined for individual text containers. These \& methods belong to the OpenOffice::OODoc::Element class. The most \& general of them are described in the OpenOffice::OODoc::XPath manual. \& Some of them (listed below) are simple read\-only accessors allowing \& the user to check the type of any element. .Ve .PP \fI\f(BIisXXX()\fI methods\fR .IX Subsection "isXXX() methods" .PP .Vb 3 \& A set of "isXXX" methods, returning true or false, allow to check \& the type of a given element. Caution, this methods belong to the \& elements, not to the document. \& \& Example: \& \& print "This is a list" if $element\->isItemList; \& \& Here is the list of element type indicators: \& \& isBibliographyMark bibliography mark (in the doc. body) \& \& isCovered covered (invisible) table cell \& \& isDrawPage presentation or drawing page \& \& isEndnote endnote main element \& \& isEndnoteBody endnote body element \& \& isEndnoteCitation endnote citation element \& \& isFootnote footnote main element \& \& isFootnoteBody footnote body element \& \& isFootnoteCitation footnote citation element \& \& isHeading heading \& \& isItemList list (ordered or unordered) \& \& isListItem list item \& \& isNote main note element (end\- or footnote) \& \& isNoteBody note body (in end\- or footnote) \& \& isOrderedList ordered list (OOo only) \& \& isParagraph paragraph \& \& isSection section \& \& isSequenceDeclarations set of sequence declarations \& \& isSpan span element (see setTextSpan) \& \& isTable table \& \& isTableCell table cell \& \& isTableRow table row \& \& isUnorderedList unordered list (OOo only) .Ve .PP \fIOther element methods\fR .IX Subsection "Other element methods" .PP .Vb 6 \& For a neater and more direct access to element types, see the \& getName method of XML::Twig::Elt. A call to $element\->getName \& returns the element\*(Aqs XML name including its namespace prefix \& e.g. \*(Aqtext:p\*(Aq for a paragraph or \*(Aqtable:table\-row\*(Aq for a table \& row. Remember that all the features of XML::Twig::Elt are \& available for any text container. .Ve .SS "Properties" .IX Subsection "Properties" .Vb 1 \& No class variables are exported. \& \& Instance properties are the same as for OODoc::XPath, plus: \& \& \*(Aqdelimiters\*(Aq => delimiter table \& \& hash giving the relation between element types and the delimiters to \& use when exporting text (see getText). \& \& \*(Aquse_delimiters\*(Aq => delimiter usage (see getText) \& \& indicates whether delimiters are to be used by getText or not when \& exporting text. Set to \*(Aqon\*(Aq by default. Can be set to \*(Aqoff\*(Aq or \& another value to stop or limit use of delimiters. \& \& \*(Aqheading_style\*(Aq => default header style \& \& indicates the default header style to be used by element creation \& methods when no style is specified. Set to \*(AqHeading 1\*(Aq by default. \& \& \*(Aqparagraph_style\*(Aq => default paragraph style \& \& indicates the default paragraph style to be used by element creation \& methods when no style is specified. Set to \*(AqStandard\*(Aq by default. \& \& \*(Aqfield_separator\*(Aq => field separator \& \& contains the character string to be used as the field separator when \& exporting tables. By default it is ";". \& \& \*(Aqline_separator\*(Aq => line separator \& \& contains the string to be used to separate lines when exporting \& "flat" text. By default, it is a line\-feed ("\en"). \& \& \*(Aqmax_rows\*(Aq => max table length (default 32) \& \*(Aqmax_cols\*(Aq => max table width (default 26) \& \& these 2 properties control the size of the "managed area" in a \& spreadsheet; the default "managed area" is the A1:Z31 rectangle, \& corresponding to the (0,0)\-(31,25) coordinates; see getTable() and \& getTableCell() and normalizeSheet() for more explanations. \& \& \*(Aqexpand_tables\*(Aq => table transformation usage \& \& indicates whether the XML representation of the spreadsheets are to \& be expanded in order to allow the same cell/row addressing scheme \& as with the tables belonging to text documents; by default, this \& property is not set. If this property is set to \*(Aqon\*(Aq, the first \& access to any sheet will automatically trigger this transformation, \& so the explicit normalizeSheet() method will not be needed. \& However, this automatic (but costly) transformation has a drawback: \& it uses the same \*(Aqmax_rows\*(Aq and \*(Aqmax_cols\*(Aq values for every targeted \& sheet, whatever the really needed managed area for each one. .Ve .SH "AUTHOR/COPYRIGHT" .IX Header "AUTHOR/COPYRIGHT" Developer/Maintainer: Jean-Marie Gouarne .PP Contact: jmgdoc@cpan.org .PP Copyright 2004\-2008 by Genicorp, S.A. .PP Initial English version of the reference manual by Graeme A. Hunter (graeme.hunter@zen.co.uk). .PP License: \s-1GNU\s0 Lesser General Public License v2.1 .SH "POD ERRORS" .IX Header "POD ERRORS" Hey! \fBThe above document had some coding errors, which are explained below:\fR .IP "Around line 2672:" 4 .IX Item "Around line 2672:" Non-ASCII character seen before =encoding in '§5.1.4'. Assuming \s-1CP1252\s0