incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick De Graeve <nick.degra...@gmail.com>
Subject Dynamic adding of bullets and table rows of fields
Date Thu, 26 Jul 2012 09:24:39 GMT
Hi


We have ODT documents in which there are a set of text fields with value
%INVULLEN%. Our application parses the document and replaces %INVULLEN%
with the appropriate value. Some of the templates have dynamic bullet lists
and tables. This is handled by a pre-parsing step that will add to the
list/table a new field with ascending number. Eg. in the document there's a
bullet list with:

* <Set variable my_field = %INVULLEN%>

There will be 3 items in the bullet list, so the pre-parser will modify the
document as follows:

* <Set variable my_field = %INVULLEN%>
* <Set variable my_field1 = %INVULLEN%>
* <Set variable my_field2 = %INVULLEN%>

The parser will then replace all %INVULLEN% in the document with the
correct values.

At this moment the pre-parser manipulates the content.xml directly by
reading it in as a String and inserting String fragments at the appropriate
place (field declaration and bullets).

I'm investigating if we can't use ODF Toolkit to do this. Our parser works
also by replacing String fragments, so it might be a candidate for
refactoring too but initially I will only use it for the pre-parser.
Is this possible with the current version of the Toolkit?

What I've tried so far is to get the list of lists with

// I have the name of the field and the # of bullet items
Iterator<List> listIterator = document.getListIterator();
while (listIterator.hasNext()) {
   List list = listIterator.next();
   // what to do next?
}

but how to proceed?
How can I determine the list with the required field?
How can I add a new item with a new field to the list?


Thanks,
Nick

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message