Convert docx to HTML with Textbox in C# or VB.net

Home Forums Open-Xml-PowerTools Convert docx to HTML with Textbox in C# or VB.net

This topic contains 0 replies, has 1 voice, and was last updated by  Rusty 1 year, 4 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11038

    Rusty
    Participant

    I am converting Word Docx files each containing several Textboxes.
    If I use wmltohtmconverter it ignores any textboxes.

    If I parse the entire document.xml file it also ignores (or doesn’t see) the textboxes.

    In VB: (the last two of the select case don’t have any effect. The first two work great in retrieving text and table contents.

    Using wDoc As WordprocessingDocument = WordprocessingDocument.Open(filename, False)
    Dim parts = wDoc.MainDocumentPart.Document.Descendants.FirstOrDefault()
    If parts IsNot Nothing Then
    For Each node In parts.ChildElements
    Select Case True
    Case TypeOf node Is Paragraph
    ProcessParagraph(CType(node, Paragraph))
    Case TypeOf node Is Table
    ProcessTable(CType(node, Table))
    Case TypeOf node Is DocumentFormat.OpenXml.OpenXmlCompositeElement
    Debug.Print(“Textbox”)
    Case TypeOf node Is DocumentFormat.OpenXml.Wordprocessing.TextBoxContent
    ProcessTextBox(CType(node, DocumentFormat.OpenXml.Wordprocessing.TextBoxContent))
    End Select
    Next
    End If
    End Using

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.