0

I want to convert HTML data to Docx word file and for that I am first converting html to xhtml using jsoup library. I have shared a code snippet here

private static String htmlToXhtml(String htmlString) throws IOException {
    final Document document = Jsoup.parse(htmlString);
    document.getElementsByTag("td").attr("style", "border:1px solid black;word-wrap:break-word;");
    document.getElementsByTag("th").attr("style", "border:1px solid black;background:#fafafa;font-weight:700");
    document.getElementsByTag("figure").attr("style","font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;");
    document.getElementsByTag("table").attr("style", "border:1px double;border-collapse: collapse;table-layout:auto;width:500px");
    document.outputSettings().syntax(Document.OutputSettings.Syntax.xml);
    return document.html();
}

Here I don't know how to convert base64 image into xhtml using Document of jsoup. Please help me here.

dhara gor
  • 3
  • 1

0 Answers0