#1
|
|||
|
|||
Convert texts to xml tags
Hi All, I have the word document which needs to be converted to the xml tags. I have attached the sample file here. Please review and let me know if you have anything required. Thanks ganesang |
#2
|
||||
|
||||
Have you tried saving the document in html format, then looking at the resulting output file's contents in Notepad?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes.
I tried that, but i am expecting to convert from word file. Because there are more different different styles involved in this word file (i will be convert the code as you provide) that needs to be converted in to xml tags based on the xsd schema file. That's why i am asking to change in the word file. thanks! |
#4
|
||||
|
||||
If you're going to craft your own macro to do this sort of thing, you'll need to do a great amount of work specifying all the criteria. To give you an idea of what's involved, the following macro applies HTML tags for just bold, italics and/or underline text, plus highlighting. Enabling the commented-out line converts auto-numbering to static text so it, too, can be processed.
Code:
Sub ApplyHTML() Application.ScreenUpdating = False With ActiveDocument.Range '.ListFormat.ConvertNumbersToText With .Find .ClearFormatting .Replacement.ClearFormatting .Format = True .Forward = True .MatchWildcards = True .Wrap = wdFindContinue .Font.Underline = True .Text = "" .Replacement.Text = "<u>^&</u>" .Execute Replace:=wdReplaceAll .ClearFormatting .Font.Bold = True .Replacement.Text = "<b>^&</b>" .Execute Replace:=wdReplaceAll .ClearFormatting .Font.Italic = True .Replacement.Text = "<i>^&</i>" .Execute Replace:=wdReplaceAll .ClearFormatting .Highlight = True .Replacement.Text = "<h>^&</h>" .Execute Replace:=wdReplaceAll End With .Style = wdStyleNormal .Font.Reset .HighlightColorIndex = wdNoHighlight End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks to providing this macro Paul!!
I will check and get back to you if any helps needed. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need to copy texts from excel and paste in to the Notepad++ in between the particular tags | ganesang | Word VBA | 2 | 08-27-2018 02:05 AM |
Change Texts In Lines | Suy Vanda | Word | 1 | 01-02-2018 05:54 AM |
Texts seperation | Tekabi | Word | 1 | 10-10-2017 02:46 PM |
Selecting Texts | mohsen.amiri | Word | 5 | 02-19-2015 11:50 PM |
Replacing texts | aslamyahya | Excel Programming | 1 | 02-27-2013 10:38 PM |