Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 08-30-2023, 05:50 PM
Journeyman Journeyman is offline HTML To Word Styles Windows 10 HTML To Word Styles Office 2019
Novice
HTML To Word Styles
 
Join Date: Feb 2023
Posts: 15
Journeyman is on a distinguished road
Default

I have determined the following when converting html to Word...

Code:
<P Class=MsoBodyText>Body Text Test</P>
<P Class=MsoListNumber>Body Text Test</P>
<Ol>
<LI Class=MsoListNumber>Testing</LI>
<OL>
Word identifies the correct style to apply - provided the style is inside the P tag.
The LI tag is recognised by the HTML editor as a list item, but is not recognised by word as a style.

However...
Code:
<Ol>
<LI Class=MsoListNumber><P Class=MsoBodyText>Testing</P></LI>
<OL>
inserting the <P> tag inside the <LI> tag works and word picks up the style, while the HTML editor picks up the list.

The question then remains, how can I set the Paragraph inside the List?

This is a basic example of how I'm setting the class for the <LI> element

Code:
Dim rng as MSHTML.IHTMLTxtRange
Dim rngElement as MSHTML.HTMLDDElement
Set rng =WBControl.Object.Document.selection.CreateRange
Set rngElement = rng.ParentElement
rngelement.classname ="MsoListNumber"
So how might I be able to insert a P tag inside the LI tag, that contains the HTML text.

Or perhaps I'm going about this the wrong way.

To start with, I have text. How can I embed that text into both the LI tag and the P tag - such as above example?

Cheers
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML To Word Styles HTML Class to Word Styles Journeyman Word VBA 4 08-17-2023 09:03 PM
HTML To Word Styles Displaying in the Styles Pane Only the Styles You Actually Use -- Which Was a Snap in Word 2003 RobertB Word 4 08-09-2022 09:29 AM
Locking styles in Word using VBA to restrict new styles cadillac1206 Word VBA 1 04-21-2020 01:08 AM
HTML To Word Styles Self-created styles in Word to appear when converting to HTML anapat Word 2 05-11-2013 09:40 PM
Can you actually write HTML and CSS in a word document and send it as an html page jackaroo Word 0 07-12-2010 07:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:02 AM.


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