This doesn't remove the last paragraph for me if there's a bookmark inside of it. Well that's at least what I'm guessing. Did you have a bookmark inside your last paragraph?

It only sets the Text to "" but leaves the paragraph.



Stephan Wunderlich schrieb:
Hi Jimmy,

The following problem only occurs, if I'm trying to remove the very last paragraph of my Writer document with my Java Addon.
I'm left with the following structure at the end of the document:

.....
<text:p text:style-name="ElmlGoals">
<text:bookmark-start text:name="goals"/>
<text:bookmark-end text:name="goals"/>
</text:p>

Alright now I can't seem to be able to remove the paragraph including it's bookmark with the following code:

xParaCursor.gotoNextParagraph(false);
xParaCursor.gotoPreviousParagraph(true);
xParaCursor.setString("");

The code works fine if there's another paragraph following. This makes even a little sense to me, since I can't go on to the next paragraph if there's no more, but how am I supposed to remove the paragraph with it's content? Do I have to do this with enumeration although it works everywhere else? How can I enumerate a paragraph if all I've got is the XParaCursor....

    xPCursor = ThisComponent.Text.CreateTextCursor
    while xPCursor.gotoNextParagraph(false)
    wend
    msgbox "last Paragraph"
    xPCursor.gotoEndOfParagraph(false)
    xPCursor.gotoStartOfParagraph(true)
    xPCursor.setString("")

removes the content of the last paragraph for me.

Hope that helps

Regards

Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to