View Single Post
 
Old 08-30-2023, 05:50 PM
Journeyman Journeyman is offline Windows 10 Office 2019
Novice
 
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