List Info

Thread: not deleting bookmarks




not deleting bookmarks
user name
2006-06-17 15:28:25
That's a hack, not even a solution. Because I do not whant
any extra
"." (DOT) in my document. And if I do this:

Dok = ThisComponent
Cursor = Dok.Text.createTextCursor
Cursor.gotoEnd( False )
Bookmark =
Dok.createInstance("com.sun.star.text.Bookmark")
Bookmark.Name = "NyttDok"
Dok.Text.insertTextContent( Cursor, Bookmark, False )
Cursor.String = "#REPLACE#"
Cursor.collapseToEnd()
Cursor.insertDocumentFromURL( ConvertToURL(KSMal3$), Array()
)
oSrch = dok.createReplaceDiscriptor()
oSrch.setSearchString ("#REPLACE#")
oSrch.setReplaceString ("IMPORTANT CONTENT!!!")
REM or oSrch.setReplaceString ("")   '
removeing the DOT
oDoc.replaceAll(oSrch)

The bookmark is deleted.



On 6/16/06, Stephan Wunderlich <stephan.wunderlichsun.com> wrote:
> Hi Knut,
>
> and if you want to keep the bookmark after insertion
...
>
> Dok=ThisComponent
> Cursor=Dok.Text.createTextCursor
> Cursor.gotoEnd( false )
> Bookmark =
Dok.createInstance("com.sun.star.text.Bookmark")
> Bookmark.Name = "NyttDok"
> Dok.Text.insertTextContent( Cursor, Bookmark, False )
> Cursor.String="."
> Cursor.collapseToEnd()
> Cursor.insertDocumentFromURL( ConvertToURL(KSMal3$),
Array() )
>
> Regards
>
> Stephan
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
>
>


-- 
Knut Olav Bøhmer

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

not deleting bookmarks
user name
2006-06-18 00:17:25
Hi Knut,

first I would suggest to use only ONE bookmark with
dimension (!=0)
that spanns over the complete inserted content instead of
using TWO
different bookmarks for the START and END-Position. If you
decide to
"switch" to a single bookmark with dimension,
the following code
should work:

Sub insertToBM
  Dok = ThisComponent
  range = Dok.Text.End

  ' set the "string" <> at the desired
insert position
  range.setString("<>")

  ' now create a Bookmark that spanns over the Text
"<>"
  Bookmark =
Dok.createInstance("com.sun.star.text.Bookmark")
  Bookmark.Name = "NyttDok"
  Dok.Text.insertTextContent(range, Bookmark, true )

  ' create an "insert"-Cursor located between
"<" and ">"
  insCursor = Dok.Text.createTextCursorByRange(range.Start)
  insCursor.goRight(1, false)

  ' insert the content
  'insCursor.setString("Hallo") 'test-insert
instead of insertDocumentFromURL
  insCursor.insertDocumentFromURL( ConvertToURL(KSMal3$),
Array() )

  ' remove char "<"
  removeCursor =
Dok.Text.createTextCursorByRange(range.Start)
  removeCursor.goRight(1, false)
  removeCursor.goLeft(1, true) ' to delete a content marked
from
  removeCursor.setString("")   ' right to left
doesn't harm the bookmark
  ' remove char ">"
  removeCursor = Dok.Text.createTextCursorByRange(range.End)
  removeCursor.goLeft(1, false)
  removeCursor.goRight(1, true)
  removeCursor.setString("")
End Sub

regards,
Christoph

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

not deleting bookmarks
user name
2006-06-18 21:46:17
These are all good workarounds or hacks, and I can use them
temporary,
but wouldn't it be best to look at the design and find a
good solution
that would make OpenOffice.org a usable platform? What would
it take
to go for a real solution. Would anyone care?  Who would I
talk to and
would they listen, or would they say "use the source,
Luke", and point
me to the cvs?


On 6/18/06, Christoph Lutz <chrlutzgooglemail.com> wrote:
> Hi Knut,
>
> first I would suggest to use only ONE bookmark with
dimension (!=0)
> that spanns over the complete inserted content instead
of using TWO
> different bookmarks for the START and END-Position. If
you decide to
> "switch" to a single bookmark with
dimension, the following code
> should work:


-- 
Knut Olav Bøhmer

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )