Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-03-2018, 06:04 AM
ganesang ganesang is offline Convert texts to xml tags Windows XP Convert texts to xml tags Office 2016
Competent Performer
Convert texts to xml tags
 
Join Date: Jul 2018
Posts: 171
ganesang is on a distinguished road
Post 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
Attached Files
File Type: docx Sample_output.docx (24.1 KB, 10 views)
Reply With Quote
  #2  
Old 10-03-2018, 02:46 PM
macropod's Avatar
macropod macropod is offline Convert texts to xml tags Windows 7 64bit Convert texts to xml tags Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 10-03-2018, 10:12 PM
ganesang ganesang is offline Convert texts to xml tags Windows XP Convert texts to xml tags Office 2016
Competent Performer
Convert texts to xml tags
 
Join Date: Jul 2018
Posts: 171
ganesang is on a distinguished road
Default

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!
Reply With Quote
  #4  
Old 10-03-2018, 11:08 PM
macropod's Avatar
macropod macropod is offline Convert texts to xml tags Windows 7 64bit Convert texts to xml tags Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #5  
Old 10-03-2018, 11:27 PM
ganesang ganesang is offline Convert texts to xml tags Windows XP Convert texts to xml tags Office 2016
Competent Performer
Convert texts to xml tags
 
Join Date: Jul 2018
Posts: 171
ganesang is on a distinguished road
Default

Thanks to providing this macro Paul!!

I will check and get back to you if any helps needed.
Reply With Quote
Reply

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
Convert texts to xml tags 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft