Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

How can I wrap some text, with formatting, with some xml tags in .

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
peace4theapes - 16 Feb 2005 22:58 GMT
Hello everybody,
I need to surround some formatted text in WORD, with some xml tags.  What I
mean here is that I have a document with different formatting, and I want to
wrap some tags around the text of some specific format. I am doing this so as
to parse the data from the document, which would be easy with the tags. It
would be great if someone gave me the regular expressions too.

Thanks,
peace4theapes
Vince - 17 Feb 2005 07:45 GMT
Sounds like the document is styled, so why not loop through the styles and
tag them as well?

> Hello everybody,
> I need to surround some formatted text in WORD, with some xml tags.  What I
[quoted text clipped - 5 lines]
> Thanks,
> peace4theapes
peace4theapes - 17 Feb 2005 16:11 GMT
Vince,
That is what I would like to do. Surround different styles with different
tags and it will be easier to parse. I thought I could use the find and
replace function for each style, but cannot figure out the regular
expression. Could you give me any further info please?

Thanks,
peace4theapes

> Sounds like the document is styled, so why not loop through the styles and
> tag them as well?
[quoted text clipped - 11 lines]
> > Thanks,
> > peace4theapes
Vince - 18 Feb 2005 01:37 GMT
Why not just do this?

Dim ST As Style

For Each ST In ActiveDocument.Styles
   With ActiveDocument.Content.Find
       .ClearFormatting
       .Style = ST

       With .Replacement
           .text = "<" & ST & ">" & "^&" & "</" & ST & ">"
       End With

       .Execute Replace:=wdReplaceAll
   End With
Next

You can do any clean up after this....

> Vince,
> That is what I would like to do. Surround different styles with different
[quoted text clipped - 20 lines]
> > > Thanks,
> > > peace4theapes
 
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.