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. text or italics - 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:
If you can help me in any way to get also nested Lists working with this macro, I would be very grateful.
Thx!
Joe
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. text or italics - 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:
Code:
[list=1]
<LI>List Item 1
[list=a]
<LI>Nested List Item 1
<LI>Nested List Item 2
[/list]
<LI>List Item 2
<UL>
<LI>Nested List Item 1[/list]
<LI>List Item 3
<LI>List Item 4
[/list]
The macro part for Lists that I am using (and which is working fine with normal, non-nested lists) is this:
Code:
Private Sub ConvertLists()
Dim zoznam As List
For Each zoznam In ActiveDocument.Lists
With zoznam.Range
If .ListFormat.ListType = wdListBullet Then
.InsertAfter "[/list]"
Else
.InsertAfter "[/list]"
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 "[*]"
.InsertAfter ""
Next i
End With
Next para
For Each zoznam In ActiveDocument.Lists
With zoznam.Range
If .ListFormat.ListType = wdListBullet Then
.InsertBefore "<ul>"
Else
.InsertBefore "[list=1]"
End If
.ListFormat.RemoveNumbers
End With
Next zoznam
End Sub
If you can help me in any way to get also nested Lists working with this macro, I would be very grateful.
Thx!
Joe