473,597 Members | 2,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy text between 2 bookmarks

I have two bookmarks,
eg. beginMark and endMark

I need to get the text between these 2 bookmarks, how do I do that?

eg.

<beginMark>
Hello Word!
This is Saturday.
Now is Sunday.
<endMark>
Nov 5 '06 #1
2 3889
I need to get the text between these 2 bookmarks, how do I do that?

Word.Document docActive = applicationObje ct.ActiveDocume nt;
object oFirstBookmark = "FirstBookmark" ;
Word.Range rngFirstBookmar k =
docActive.Bookm arks.get_Item(r ef oFirstBookmark) .Range;
object oSecondBookmark = "SecondBookmark ";
Word.Range rngSecondBookma rk =
docActive.Bookm arks.get_Item(r ef oSecondBookmark ).Range;
object firstBookmarkEn d = rngFirstBookmar k.End;
object secondBookmarkS tart = rngSecondBookma rk.Start;
Word.Range rngTarget =
docActive.Range (ref firstBookmarkEn d, ref secondBookmarkS tart);
string DesiredText = rngTarget.Text;

--
Bill Coan
bi******@wordsi te.com
920-779-9148
"Alan T" <al************ *@yahoo.com.auw rote in message
news:u8******** ******@TK2MSFTN GP04.phx.gbl...
>I have two bookmarks,
eg. beginMark and endMark

I need to get the text between these 2 bookmarks, how do I do that?

eg.

<beginMark>
Hello Word!
This is Saturday.
Now is Sunday.
<endMark>

Nov 5 '06 #2
Thanks.
I have 2 questions about that:
1) I need to put the text or content between 2 bookmarks into a bookmark in
another document.

Word.Range rngTarget = docActive.Range (ref firstBookmarkEn d, ref
secondBookmarkS tart);
object oThirdBookmark = "Bookmark3" ;
Word.Range rngThirdBookmar k = doc3.Bookmarks. get_Item(ref
oThirdBookmark) .Range;
How do I tell to insert the content at that bookmark in my second document ?

2) Do you think Copy and Paste is good ?

"Bill Coan" <bi******@words ite.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I need to get the text between these 2 bookmarks, how do I do that?

Word.Document docActive = applicationObje ct.ActiveDocume nt;
object oFirstBookmark = "FirstBookmark" ;
Word.Range rngFirstBookmar k =
docActive.Bookm arks.get_Item(r ef oFirstBookmark) .Range;
object oSecondBookmark = "SecondBookmark ";
Word.Range rngSecondBookma rk =
docActive.Bookm arks.get_Item(r ef oSecondBookmark ).Range;
object firstBookmarkEn d = rngFirstBookmar k.End;
object secondBookmarkS tart = rngSecondBookma rk.Start;
Word.Range rngTarget =
docActive.Range (ref firstBookmarkEn d, ref secondBookmarkS tart);
string DesiredText = rngTarget.Text;

--
Bill Coan
bi******@wordsi te.com
920-779-9148
"Alan T" <al************ *@yahoo.com.auw rote in message
news:u8******** ******@TK2MSFTN GP04.phx.gbl...
>>I have two bookmarks,
eg. beginMark and endMark

I need to get the text between these 2 bookmarks, how do I do that?

eg.

<beginMark>
Hello Word!
This is Saturday.
Now is Sunday.
<endMark>


Nov 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2595
by: ingvald | last post by:
hi, i've hit a wall regarding php and ms word. what i want is to open a document containing bookmarks, insert text where the bookmarks are, and save. it's working, unless the bookmark is in the header part of the page (re header/ footer). in that case i get an error saying the bookmark wasn't found/ doesn't exist.
0
1516
by: Javier | last post by:
I have a problem when i try to insert text in a word document.I have bookmarks in the word doc but when intesrt text in a determinate range(i use the range property of word bookmarks) i don't get that the text inserted don't move the rest of the text of the document.I want that the text inserted be inserted in overwrite mode.Sorry the gramatic... I don't want that the lenght of the text inserted move the other text.
2
1527
by: Jay | last post by:
Is there a way to copy text that is always in the same place in a word document, (such as an id number in my case) and then paste it into a text box in another program? I've tried various approaches but none of them seem to work. Thank You
0
1217
by: Mark Hayworth | last post by:
In VB6, you could set bookmarks that were in different files/module/classes/documents. When you clicked the flag tool to go to the next bookmark, it would take you there, regardless if that bookmark was in the same file or not. Now, with VB.Net in VisualStudio.Net, it will only traverse bookmarks in the same file. It won't go to the next file. For example, let's say I have book marks at lines 100 and 200 in frmMain.vb and at line 300...
15
5973
by: Francach | last post by:
Hi, I'm trying to use the Beautiful Soup package to parse through the "bookmarks.html" file which Firefox exports all your bookmarks into. I've been struggling with the documentation trying to figure out how to extract all the urls. Has anybody got a couple of longer examples using Beautiful Soup I could play around with? Thanks, Martin.
0
4074
by: JosAH | last post by:
Greetings, the last two article parts described the design and implementation of the text Processor which spoonfeeds paragraphs of text to the LibraryBuilder. The latter object organizes, cleans up and stores the text being fed to it. Finally the LibrayBuilder is able to produce a Library which is the topic of this part of the article. Introduction
0
4054
by: JosAH | last post by:
Greetings, Introduction At this moment we have a TextProcessor, a LibraryBuilder as well as the Library itself. As you read last week a Library is capable of producing pieces of text in a simple way. We also briefly mentioned the BookMark which represents a single paragraph of text. We haven't seen it's implementation yet. This is the topic of this week's article part.
1
4420
by: JosAH | last post by:
Greetings, Introduction This week we start building Query objects. A query can retrieve portions of text from a Library. I don't want users to build queries by themselves, because users make mistakes. Instead, the Library hands out queries to the user given a simple query String. This is how the library does it:
0
7967
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6687
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5428
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2403
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1233
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.