Hi,

Just FYI:
I have now a solution. Please see below.

Gelonida wrote:

>> I'd like to extract all tables of an odt files and extract each table's
>> the contents cell by cell. (in order to transfer it to a spread sheet)
>>

def mymacro_text_tables():
    info = []
    doc = XSCRIPTCONTEXT.getDocument()
    text = doc.Text
    fh = open("result.txt","a")
    tables = doc.Tables     # This gets an object with all tables
    table_names = tables.getElementNames() # get all table names
    cnt = 0
    for name in table_names:
        cnt += 1
        table = tables.getByName(name)
        for cell_name in ["A1","B1","A2"]:
            cell = table.getCellByName(cell_name)
            do_something_with_cell(cell)
    fh.write( "found %d tables\n" % cnt )
    fh.close()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to