Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / June 2006

Tip: Looking for answers? Try searching our database.

Problem with Bookmark

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kausar Parveen - 08 Jun 2006 13:15 GMT
Hello All,

      I used a bookmark ( internal Microsoft.Office.Tools.Word.Bookmark
bkCode)  in Wordtemplate  application.
     When i am writing bkCode.Range.Text ="Hello";
       and when i access the    bkCode next time it doesn't exist anymore.

    When i wrote bkCode.Text ="Hello";
    "Hello" appears in square brackets on the document.
    how do i remove this square brackets?

   What is the correct way to add/retrieve text on/from Bookmark?

Best Regards
Kausar
VictorH - 28 Jun 2006 18:09 GMT
The square brackets are the (non-printable) boundaries of the bookmark.
The elimination of the bookmark when you insert text in the range comes from
Word. It does also happen in VBA.

You can do something like this (in pseudo code) in VBA, it should not be
hard to change it to .Net

dim r as range
set r = activedocument.bookmarks(bm_name).range
r.range.text = "hello"
activedocument.bookmarks.add bm_name, r

now the text is in the bookmark (with the brackets). If you want to keep the
bookmark at the beginning you can use something as

r.range.text = "hello"
r.collapse wdCollapseDirectionStart
activedocument.bookmarks.add bm_name, r

success
Signature

--
Victor Heijke
Microsoft Certified Professional
Software architect at Flores Automatisering
Amsterdam, the Netherlands
http://www.flores.nl

>  Hello All,
>
[quoted text clipped - 11 lines]
> Best Regards
> Kausar

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.