Hi Guys,
i have a html table which uses styles from a stylesheet. I would like to import the whole whole table into a worddocument. Is it possible tó do that with aspose words and also what is the sample coding.
thanks for your help.
best regards,
Kai wachte
Hi
Thank you for your interest in Aspose.Words. You can import your table into the word document using DocumentBuilder.InsertHtml method. See the following link.
https://reference.aspose.com/words/net/aspose.words/documentbuilder/inserthtml/
Also you can convert HTML to DOC using the following code.
Document doc = new Document(@"in.html");
doc.Save(@"out.doc", SaveFormat.Doc);
Unfortunately, Aspose.Words doesn’t support styles during converting HTML to DOC. See the following links to learn more.
https://docs.aspose.com/words/net/load-in-the-html-html-xhtml-mhtml-format/
https://docs.aspose.com/words/net/supported-document-formats/
Best regards.
Hi Alexey,
thanks for your fast respose. When i try to insert the following Html:
Country | Billed Quantity | |
---|---|---|
BG | Bulgaria | 864 ST |
DE | Germany | 4.861 ST |
DK | Denmark | 5.215 ST |
EN | England | 4.937 ST |
ES | Spain | 4.447 ST |
FI | Finland | 1.431 ST |
FR | France | 576 ST |
IT | Italien | 4.069 ST |
MO | Montenegro | 600 ST |
NL | Netherlands | 5.457 ST |
NO | Norway | 357 ST |
PL | Poland | 4.005 ST |
RU | Russia | 5.234 ST |
SA | SA | 463 ST |
SE | Sweden | 4.726 ST |
Overall Result | 47.242 ST |
It generates a word file with correct tables but the colors are ignored.
My coding looks like this:
Dim ldoc As New Aspose.Words.Document
Dim lbuil As New Aspose.Words.DocumentBuilder(ldoc)
lbuil.InsertHtml(lstring)
ldoc.Save("c:\dummy.doc", Aspose.Words.SaveFormat.Doc)
lstring is read from a file before.
best regards,
kai
Hi
Thanks for additional information. As I said earlier Aspose.Words doesn’t support styles during converting HTML to DOC. That’s why colors are ignored. This feature will be implemented in one of the future releases.
Best regards.
Hi Alexey,
in the document you provided: https://docs.aspose.com/words/net/supported-document-formats/
you see Document element Styles with a * supported as inline styles
i use only inline styles so according to your documentation it should work.
regards,
kai
Hi
Styles are supported when exporting to HTML. But inline CSS styles support is limited, when importing HTML into Word document.
Best regards.