# 20120420¶

## How to generate chunks of ODF XML¶

The [pdf] button now produces a pdf with correct column widths. Checkin abf9ee80039f.

Now I’ll take some time to find the “best” method for generating chunks of ODF XML. Currently I’m using odfpy which looks something like:

doc = OpenDocumentText()

tablecontents = Style(name="Table Contents", family="paragraph")
linenumber="0"))

linenumber="0"))

table = Table()

for i,fld in enumerate(fields):
cs = Style(name=fld.name, family="table-column")

hr = TableRow()
for fld in fields:
tc = TableCell()
text=force_unicode(fld.field.verbose_name or fld.name)))

for row in ar.data_iterator:
tr = TableRow()

The problem with odfpy is that it is not really used and probably will not be maintained. So I’m going to try and do the same using my own lino.utils.xmlgen.odf module (which in turn is in fact just a wrapper around lxml).