Thread: [Solved] HTML Class to Word Styles
View Single Post
 
Old 08-17-2023, 08:06 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Note that you can also make use of style aliases to 'force' a tagged paragraph into a specific style when you don't know its built-in MsoXXX title

For instance, if I wanted to make any of these map to a specific style in Word then I could firstly add them as stylename aliases in Word and then import the html.
In the case of the Heading 1 style in Word, change the stylename in your Word doc to "Heading 1,random,fubar" which means you can then import the following html lines which all become Heading 1 in the document.
Code:
<p Class=random>Heading 1 Vestibulum ut diam magna. Maecenas ut interdum ante, vel volutpat nibh</p>
<p Class=fubar>Heading 1 Vestibulum ut diam magna. Maecenas ut interdum ante, vel volutpat nibh</p>
<h1>Heading 1 Vestibulum ut diam magna. Maecenas ut interdum ante, vel volutpat nibh</h1>
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote