Hi fellow VB knowers (I am but a learner still).
I have a question for you which I struggle with. I need to convert nested Lists in MS WORD (whether numbered or bulleted or mixed) from their original format to a tag-formatted text (as used for instance for Wiki articles or phpBB Forums and such). In my particular case I need the text to have basic HTML tags for the basic formatting - e.g. <strong>text</strong> or <em>italics</em> - and this final text is used for a Drupal web-system which does the article formatting based on these simplified (or rather reduced) HTML tags.
The basics as Bold or Italics or Headings is not the problem, as I found the Word2MediaWiki macro for Word and edited it to my purposes (mainly giving pre- and post-tags to blocks of given formatting). I also have figured basic Lists, using non-nested items.
What I have problem figuring out how to do are the nested Lists, either numbered (mixed), bulleted (mixed) or totally mixed. The final output should be something like this:
The macro part for Lists that I am using (and which is working fine with normal, non-nested lists) is this:Code:<OL TYPE="1"> <LI>List Item 1 <OL TYPE="a"> <LI>Nested List Item 1 <LI>Nested List Item 2 </OL> <LI>List Item 2 <UL> <LI>Nested List Item 1</UL> <LI>List Item 3 <LI>List Item 4 </OL>
If you can help me in any way to get also nested Lists working with this macro, I would be very grateful.Code:Private Sub RPGskConvertLists() Dim zoznam As List For Each zoznam In ActiveDocument.Lists With zoznam.Range If .ListFormat.ListType = wdListBullet Then .InsertAfter "</ul>" Else .InsertAfter "</ol>" End If End With Next zoznam Dim para As Paragraph For Each para In ActiveDocument.ListParagraphs With para.Range For i = 1 To .ListFormat.ListLevelNumber .InsertBefore "<li>" .InsertAfter "</li>" Next i End With Next para For Each zoznam In ActiveDocument.Lists With zoznam.Range If .ListFormat.ListType = wdListBullet Then .InsertBefore "<ul>" Else .InsertBefore "<ol>" End If .ListFormat.RemoveNumbers End With Next zoznam End Sub
Thx!
Joe


Reply With Quote