Writer TextTable access via the UNO API

Adomas VenĨkauskas adomas.ven at gmail.com
Fri Jul 5 09:00:49 UTC 2019


Just to update for anyone who might find this useful, I ended up using the
XTextRange interface of XCell to call #getText(), which returns an object
that properly supports the full Text service and which ended up allowing me
to iterate over paragraphs and text portions.


On Fri, 21 Jun 2019 at 20:19, Andrew Pitonyak <andrew at pitonyak.org> wrote:

> In OOME, I do not really discuss this, but, I do in AndrewMacro.odt where
> I claim (in the section "Enumerating cells in any text table" that you need
> to first use getCellNames() and then use getCellByName(aName).
> If you want to be even more complete, you may need to worry about things
> such as sections, floating frames, etc. Annoying, right? I don't think that
> I have ever written code that attempts to enumerate all of these things to
> get every XText object. Luckily, some of these things you can simplify by
> enumerating certain objects independtly; for example, you could enumerate a
> Single XText object in a single method, and then get all of the text tables
> using oDoc.getTextTables() and have a method to specifically handle text
> tables rather than recognizing them as you traverse the text; if you did
> not need to retain locality or something.
> On Friday, June 21, 2019 09:56 EDT, Michael Stahl <mst at libreoffice.org>
> wrote:
> On 21.06.19 13:22, Adomas VenĨkauskas wrote:
> > Hello,
> >
> > I need my Java extension to iterate over all hyperlinks in a Writer
> > document. This is fine with Paragraph TextPortion enumeration, but no
> > portion enumeration is available in TextTables. What would be the best
> > way to enumerate all hyperlinks in TextTables?
> you first need to enumerate the cells in the table, then the cells
> implement XText so you can enumerate the paragraphs in the cells like
> the paragraphs in the top-level body text.
> to enumerate the cells i guess you can use getCellNames().
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20190705/2b86b803/attachment.html>

More information about the LibreOffice mailing list