I guess that's the only option left...
Thanks though.

Andrew Douglas Pitonyak schrieb:
If you know that it surrounds the entire paragraph, then I do not expect that setting the text to "" will remove the paragraph (actually, any behavior seems possible). Why not check for and explicitly remove the the bookmark while remove the paragraph.

[EMAIL PROTECTED] wrote:

Alright testing finished :)

This behavior indeed only happens with a selection bookmark surrounding the WHOLE text of the paragraph. If only a part of the paragraph is surrounded it works, and if nothing is surrounded it works as well.

Well but since it isn't forbidden to surround the whole text of a paragraph with a bookmark, it shouldn't be the issue here. It should still be possible to remove it the same kinda way?!

1.) doesn't work
<text:p text:style-name="Standard">
<text:bookmark-start text:name="Test"/>Test<text:bookmark-end text:name="Test"/>
</text:p>

2.) works
<text:p text:style-name="Standard">
<text:bookmark-start text:name="Test"/>T<text:bookmark-end text:name="Test"/>est
</text:p>

3.) works
<text:p text:style-name="Standard">
<text:bookmark text:name="Test"/>Test
</text:p>



Cor Nouws schrieb:

Andrew Douglas Pitonyak wrote:

The problem may be related to the anchor point of your bookmark.

Or to the fact that
- the bookmark is a selection bookmark, that holds the entire contents of the paragraph;
- there is only one parapraph (according the discription given below);

So, some more tests to drive ;-)




Jimmy wrote:

Alright now, this is really getting spooky. I'm now using exactly your macro and it doesn't do what it's supposed to do. Let me get the steps straight:

1.) open new writer document
2.) add Text "Test" to document
3.) select the word "Test" and insert a bookmark
4.) select the word "Test" again and insert a section
5.) executing your macro

Here we go with the XML before executing the macro:

<office:body>
<office:text>
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:section text:style-name="Sect1" text:name="Test">
<text:p text:style-name="Standard">
<text:bookmark-start text:name="Test"/>Test<text:bookmark-end text:name="Test"/>
</text:p>
</text:section>
</office:text>
</office:body>


The XML after executing:

<office:body>
<office:text>
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="Standard">
<text:bookmark-start text:name="Test"/>
<text:bookmark-end text:name="Test"/>
</text:p>
</office:text>
</office:body>

Why aren't you getting the same results?

Oh by the way: Win XP/OO.org 2.0.3



Stephan Wunderlich schrieb:

Hi Jimmy,

Well you're right, there must be something spooky about my bookmarks, that's why I went looking a little further. You were right this works just fine, BUT (who would have expected that) I do have a section around the paragraph at first which I remove either by

currSect.dispose();    or
xText.removeTextContent(currSect);

Both work fine, afterwards I'm left with the same xml as if there has never been any section. So I'm executing the code you proposed ........AND it doesn't remove the silly bookmark.

So can you beat that? :)




I'll try my best ;-)

Ok now I put my last paragraph into a TextSection and execute

    xSection = ThisComponent.TextSections(0)
    xText = ThisComponent.getText()
    xPCursor = ThisComponent.Text.CreateTextCursor

    xText.removeTextContent(xSection)

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

Afterwards the section and the bookmark are gone.
Are you sure that there isn't an empty paragraph behind your section ?

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]





---------------------------------------------------------------------
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