【发布时间】:2020-03-23 17:54:21
【问题描述】:
我想在 itext pdf 中显示所有格式的 oracle clob 数据。 目前我正在使用以下代码来显示它。
java.sql.Clob clob=rs.getClob("MESSAGE");
Reader r = clob.getCharacterStream();
char clobVal[] = new char[(int) clob.length()];
r.read(clobVal);
StringWriter sw = new StringWriter();
sw.write(clobVal);
//add some detail information about the country
doc.add(new Paragraph("Country Code: " + sw.toString(), bf12));
上面的代码只显示字符串,但没有文本格式或 html 格式数据。请帮忙。
【问题讨论】:
-
你的 clob 数据里面有什么?能给个样品吗?
-
我在 CLOB 中有 html 数据。
-
在这种情况下,您应该使用 itext 类进行 html 到 pdf 的转换。根据您回答的标签,我假设您使用 itext 5.5.x。因此,您应该使用它的
XMLWorker。 -
如果您使用的是 iText 7,请使用 pdfHTML。
-
是的,我正在使用 itext 5.5 ...好的,非常感谢您,我将使用 itext 7,然后我会通知您问题是否已解决...非常感谢您的回复。跨度>