HtmlToWmlConverter – broken output file if HTML contains anchor within a span

Home Forums Open-Xml-PowerTools HtmlToWmlConverter – broken output file if HTML contains anchor within a span

This topic contains 1 reply, has 2 voices, and was last updated by  Eric White 8 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3570

    harlequin
    Participant

    Hi there,

    I’m using the “HtmlToWmlConverter.ConvertHtmlToWml” method and a broken WML/DOCX file is being generated (I get the familiar “file cannot be opened because there are problems with the contents” error) after converting the following simple markup:

    <!DOCTYPE html>
    
    <html>
      <head>
        <meta charset="UTF-8"/>
        <title>Hello</title>
      </head>
      <body>
        <span>Link to <a href="http://www.google.ca">Google</a> website.</span>
      </body>
    </html>

    If i change the SPAN to a block-level element (i.e. a “P” or “DIV”) then the markup is converted without issue. I’m also unable to successfully convert HTML to WML if the source contains an “EM” tag within a SPAN (and again, replacing the SPAN with a block-level element resolves this).

    If someone could please point me towards a solution that does not involve changing the markup, that would be greatly appreciated.

    Many thanks.

    #3688

    Eric White
    Keymaster

    Hi,

    Sorry for the inconvenience. This is something that I hadn’t contemplated when writing this module. Should have, but didn’t. What is probably happening is that it is generating runs as direct children of the w:body element. In general, HtmlConverter expects block-level content as children of the element.

    This will require a certain amount of work to enhance HtmlToWmlConverter to do this. I’ve added this item to my list.

    I am not certain as to when this will get on my schedule. Probably not in the immediate future, though. Wish I had a better answer for you, but I don’t.

    Cheers, Eric

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.