-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert html to Word,html forrmat is #85
Comments
是不是多了层\"
| |
魏强
|
|
***@***.***
|
…---- Replied Message ----
| From | ***@***.***> |
| Date | 06/27/2022 12:39 |
| To | ***@***.***> |
| Cc | ***@***.***> |
| Subject | [aspose-words/Aspose.Words-for-Java] Insert html to Word,html forrmat is (Issue #85) |
I want to convert HTML to doc format, but I find that the style doesn't work, including setting the line spacing of paragraphs
code example:
but in fact:
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
DocumentBuilder builder = new DocumentBuilder();
ParagraphFormat paragraphFormat = builder.getParagraphFormat();
paragraphFormat.setLineSpacingRule(LineSpacingRule.MULTIPLE);
paragraphFormat.setLineSpacing(24);
builder.writeln("word测试类型");
builder.writeln(LocalDateTime.now().toString());
builder.insertHtml("<a href='https://wwww.baid.com' _target='blank'>百度一下,都知道</a>");
builder.insertHtml("<p style='text-align:center;color:red;background-color:gray;'>文字居中显示</p>");
Document document = builder.getDocument();
document.save("./logs/test.docx");` |
嗯嗯,这个问题时多了一层。 已经找到原因了,现在第二个问题感觉不知道怎么设置,有些标签样式不生效了 |
@WEIQ311 https://res.hwazhan.com/bg/upload/files/2022/6/1656329823006.txt?attname=html5.txt |
@Wang0310 @WEIQ311 The problem is that HTML document and MS Word document has quite different object model. And it is impossible to guaranty 100% fidelity after converting one to another. You can learn more about feature supported upon loading HTML from Aspose.Words documentation. In your case, you can achieve what you need using table with two cells in your HTML. |
@AlexNosk ok, but I have another question. why can't the program set line spacing in HTML content take effect. |
@Wang0310 Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertHtml("<p style=\"line-height:20pt;\">test</p><p style=\"line-height:20pt;\">test</p>");
doc.save("C:\\Temp\\out.docx"); |
@AlexNosk OK, I see. thank you very much. |
I want to convert HTML to doc format, but I find that the style doesn't work, including setting the line spacing of paragraphs
code example:
but in fact:
The text was updated successfully, but these errors were encountered: