extract text from ods TableCell using odfpy
John Machin
sjmachin at lexicon.net
Tue Aug 26 16:52:33 EDT 2008
On Aug 27, 3:04 am, norseman <norse... at hughes.net> wrote:
> frankentux wrote:
> > Ok. Sorted it out, but only after taking a round trip over
> > xml.minidom. Here's the working code:
>
> > #!/usr/bin/python
> > from odf.opendocument import Spreadsheet
> > from odf.opendocument import load
> > from odf.table import TableRow,TableCell
> > from odf.text import P
> > doc = load("/tmp/match_data.ods")
> > d = doc.spreadsheet
> > rows = d.getElementsByType(TableRow)
> > for row in rows[:2]:
> > cells = row.getElementsByType(TableCell)
> > for cell in cells:
> > tps = cell.getElementsByType(P)
> > if len(tps) > 0:
> > for x in tps:
> > print x.firstChild
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> =========================
> cd /opt
> find . -name "*odf*" -print
> (empty)
> cd /usr/local/lib/python2.5
> find . -name "*odf*" -print
> (empty)
>
> OK - where is it? :)
>
Consider using:
find --http --google "odfpy"
;-)
More information about the Python-list
mailing list