3

during my test, I find when converting following html content to docx, the original style will be lost.

  1. < a href="http://www.google.com">Google< /a>

    result in docx: no underline.

  2. < p>< span style="text-decoration: underline;">underline text< /span>< /p>

    result in docx: no underline

  3. < p>< span style="text-decoration: line-through;">delete text< /span>< /p>

    result in docx: no delete line

  4. < p style="margin-left:30.0px;">indent text< /p>

    result in docx: no any indent

  5. < h1>header line< /h1>

    result in docx: only plain text

  6. < p>< span style="background-color: rgb(255,255,0);">background color< /span>< /p>

    result in docx:no any background-color

  7. < hr/>

    result in docx: empty

  8. < table style="border-width:1px;">...

    result in docx: no border

  9. < span style="font-family: arial , helvetica , sans-serif;font-size: large;">...

    result in docx: font setting all missed.

Any one know how to deal with these issues? or any workaround?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118

1 Answers1

1

The comment in the XHTMLImporter source code notes that some of these things remain to be implemented.

Re your #4, I think indent is supported. Maybe just not for the units you have used?

Re your #8 table borders, there is some support for these; Google for other posts.

Implementing underline, delete, and background-color all ought to be straightforward.

If you'd like to do that, we're happy to accept a pull request.

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
  • Thanks for your quickly response. for #4,Could you give me a workable example? for #8, after I changed to < table border="1"> the table border can be shown. for underline,delete,and background-color official support, do you have any time schedule? I can implement it straightforward, but it will cost much time. :-) – simpletosimple Mar 28 '13 at 09:49
  • Looking at the code, for margin-left, inches and mm are supported. No specific plans to work on this right now, although it would be nice to spend a day or 2 on it before the docx4j 3.0 release. – JasonPlutext Mar 28 '13 at 10:44
  • Current nightlies (and code on GitHub) support underline, and some additional units of measurement for indent. – JasonPlutext Apr 03 '13 at 20:53