Hi, I'm still stuck.Gelonida wrote: > Hi, > > > 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) > > > I look for an automated way to perform this task. > > What I am stuck with are the apropriate objects and the apropriate > methods to use. > > > My tasks are therefore > 1.) locate tables in a document with uno > 2.) get each tables dimensions > 3.) extract each tables cell and process it with my script. > > > Thanks a lot for any hints
This is what I wrote so far: def mymacro_text_tables(): info = [] doc = XSCRIPTCONTEXT.getDocument() text = doc.Text fh = open("result.txt","a") #### well here I'm lost. #### how to get all tables in a document tables = ?????? #### table_enum = tables.createEnumeration() # this line is guessed cnt = 0 while table_enum.hasMoreElements(): # this line is guessed cnt += 1 table = table_enum.nextElement() # this line is guessed 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: users-unsubscr...@openoffice.org For additional commands, e-mail: users-h...@openoffice.org