Free Support Forum - aspose.com

Problem converting html-file to xps

Hello,

I try to convert the attached html-file to xps. The formatting doesd not look really good. Can I improve this.
And some data (for example the numbers on the bottom of the file “3.985,99”) are missing. Could you please check?

This is the code, I use:
Aspose.Words.License wLic = new Aspose.Words.License();

wLic.SetLicense(“Aspose.Total.lic”);



Aspose.Words.Document doc;

doc = new Aspose.Words.Document(“D:\Temp\20121019_Aspose_Html.html”);

doc.Save(“D:\Temp\20121019_Aspose_Html.html.xps”, Aspose.Words.SaveFormat.Xps);

doc.Sections.Clear();

Kind regards,
Oliver

Hi Oliver,

Thanks for your inquiry. In this case, you should just call Document.UpdateTableLayout method before rendering to XPS format; only in rare cases where you confirmed that tables appear incorrect in the output document. I hope, calling this method will help to correct the output. Here is how you should use it:

Document doc = new Document(@"c:\test\in.html");

...

...

doc.UpdateTableLayout();

doc.Save(@"c:\test\out.xps");


Best Regards,

Hi Awais,

thank you for your help. I just tried the UpdateTableLayout but the result was the same. The layout does not look really good and the lines are still missing. Did you check my example on your side?`

best regards,

Oliver

Hi Oliver,


Thanks for your inquiry. I have attached the XPS file, i.e. generated on my side using Aspose.Words v11.8.0, here for your reference. Could you please create and attach here a screen shot that highlights the problematic areas in this out.xps file. I will investigate the issue further on my side and provide you more information.

Best Regards,

Hi,
looks like you missed to attach the XPS-file? I attach the oroginal html-file as screenshot with red circles around the missing data. Could you please check? (I use the same version of Word.dll)

Thank you.

kind regards,
Oliver

Hi Oliver,


Thanks for your inquiry. I have attached a couple of XPS documents here with this post now. The one is produced with Aspose.Words and other by MS WORD. I apologise for the inconvenience. Moreover, please note that when you open your HTML file with Microsoft Word and then save to XPS format, the numbers you highlighted in the PDF are not displayed in there as well.

Best Regards,

Hi,
thank you for your help. I see your point, ms-word can not convert this either. I just found out, that I need to interprete the javascript to get good results. I found a tool, that can do that, so I try this.
This topic can be closed, thanks again for your support!

kind regards,
Oliver

Hi Oliver,


Thanks for your feedback on this. Please note that Aspose.Words tries to mimic the way the Microsoft Word’s page layout engine works. To you, this means that if you convert a Microsoft Word document into PDF, XPS or print it using Aspose.Words, the output will appear almost exactly as if it was done by Microsoft Word. Please let us know any time you have any further queries. We’re always glad to help you.

Best Regards,