We're sorry Aspose doesn't work properply without JavaScript enabled.

# Printing problem

Hi there,

I have a document that looks fine when opened in MSWord, but when I try to print it via Aspose.Word the result is not as expected.
In particular there is a row in a table which looks correctly when the doc is opened or printed with Word, but grows very much when printed using Aspose.Word.
You can see the difference in the files attached (the pdf has been generated printing the .doc with Aspose.Word).

Thank you very much
Francesco

Hi
Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
As a workaround, you can try open/save your document in MS Word and then use this document with Aspose.Words.
Best regards,

In fact after I save it using Word it does behave well even in Aspose.
Anyway I hope you’ll be able to fix the problem soon, since we are trying to completely avoid the use of Word.

Thanks again
Francesco

Hi
Thank you for additional information. I managed to find a simple workaround of this issue. Please see the following code:

Document doc = new Document(@"Test001\Testata.doc");
// Reset row formating.
Node[] rows = doc.GetChildNodes(NodeType.Row, true).ToArray();
foreach (Row row in rows)
row.RowFormat.ClearFormatting();
doc.Save(@"Test001\out.pdf");


Hope this helps.
Best regards,

Well, the work around doesn’t work for me. In fact, the doc that I attached is just the first part of a bigger document which includes other tables (I attached only that part to keep the example simpler). Applying your solution that row prints OK, but I lose the formatting of other rows in the doc (I can attach the full doc, too, if you think that can be useful).

Thanks again

Francesco

Hi Francesco,
Thank you for additional information. It would be great if you attach full document. Maybe I will manage to find a workaround that will fit your requirements.
Best regards,

Ok,

This is the complete file.
When I try to print it with the workaround the lines separating the heading from the rest of the text disappear on the first page, and the same happens to the borders around “COMMENTO PROPONENTE” on the first page, “RISCHIO DIRETTO” on the second, and “RISCHIO INDIRETTO” on the third.
Part of the contents of various cells are truncated, too (e.g. page five).

Thank you
Francesco

Hi
Thank you for additional information. It seems the following condition added into the code makes result a little better:

Document doc = new Document(@"Test001\in.doc");
// Reset row formating.
Node[] rows = doc.GetChildNodes(NodeType.Row, true).ToArray();
foreach (Row row in rows)
{
if (row.RowFormat.Borders.LineStyle == LineStyle.None)
row.RowFormat.ClearFormatting();
}
doc.Save(@"Test001\out.pdf");


Hope this helps. We will let you know when the original issue is resolved.
Best regards

Yes, it works with this doc because the borders of that particular row are set for the single cell and not for the whole row. The problem here is that we write the code generating and adding the different rows, but the formatting (i.e. borders, fonts, spacing) can be changed by the single customers using word before the generation of the doc, so I can’t be sure of the final result.
Looking your workaround I thought that the problem was in the formatting of the rows, so I cut away everything except the row with problems (I used the Document Explorer sample that came with Aspose). The result is the file TestataSimple.doc that I attached and which still presents the problem. Then I opened this file with words and saved it in TestataSimpleW.doc. This file prints OK with Aspose.
I looked for differences in the RowFormat quickwatching it in VisualStudio after executing these lines of code, but I wasn’t able to find any.

Document aDoc1 = new Document("testatasimple.doc");