Hello there,

I'm trying to generate a open office text document with tables generated from a database with the lpod library.
I'd like to set the width of the tables columns but i can't manage it.
Here is my test code so far :

import lpod.document
import lpod.table

doc = lpod.document.odf_new_document_from_type('text')
body = doc.get_body()

col_1_style = lpod.style.odf_create_style('table-column', 'column1', width='4cm')
doc.insert_style(col_1_style)

table = lpod.table.odf_create_table(u"Table 1", width=2, height=3)
for i in range(3):
    row = table.get_row(i)
    row.set_cell_values(range(2))
    table.set_row(i, row)

col = table.get_column(1)
col.set_column_style('column1')
table.set_column(1, col)

body.append(table)

doc.save("lpod_test.odt")

Does someone know how i am supposed to do to set the column width to 4 cm ?

Thanks for your help

Nobody knows ?

This is a python forum. There are several forums on the open office site.

Sorry, I thought i was writing python code ;-)
Thanks anyway, i'll look at ooo forums.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.