On Tue, 2006-10-24 at 23:08 +0200, Cor Nouws wrote:
> Ian Shields wrote:
>
> > I'm investigating writing a filter using Java and UNO. So far, I can
> > iterate over text in a writer document, but I'm having trouble with
> > graphics. I can use an XTextCursor to create an
> > XContentEnumerationAccess and then find TextContent items using
> > XEnumeration xTextContentEnum = xTextContentAccess
> > .createContentEnumeration("com.sun.star.text.TextContent");
> >
> > But I'm baffled as to how to pick up graphics that are anchored at a
> > paragraph as I iterate through a document. Is there a general
> > methodology for a filter to iterate over ALL the content of a Writer
> > document in order?
> >
> I'm only able to help a little. AFAIK you should find it in the DrawPage
> of the document.
>
> Regards,
> Cor
>
I'm beginning to suspect that I need something other than paragraph
enumeration. The snippet at
http://codesnippets.services.openoffice.org/Writer/Writer.EnumerateContent.snip
has a section:
REM Typically, I use an empty string to enumerate ALL content,
REM but this causes a runtime error here. If any graphics images are
REM present, then they are enumerated as TextContent.
oContentEnum =
oPar.createContentEnumeration("com.sun.star.text.TextContent")
Do While oContentEnum.hasMoreElements()
oContent = oContentEnum.nextElement()
If oContent.supportsService("com.sun.star.text.TextGraphicObject") Then
Print "Found a graphic object anchored to a Paragraph"
End If
Loop
but when I implement that in Java, the graphic objects that are
anchored to a paragraph never show up in this loop. If I turn on the
display of paragraph markers, the anchor appears to be at the start of a
paragraph and it moves up or down the page with the surrounding
paragraphs.
Is this a bug or is the snippet example just wrong? I'm using OOo 2.0.2
on Fedora Core 5.
--
Ian Shields <[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]