PDF layout doesn't correspond Word layout - Table is built incorrectly in new release

Hi guys,


I use Aspose.Words to generate reports. There is an issue I’ve noticed recently. The PDF output doesn’t correspond to Word output in terms of placing the paragraphs on one or another page (compare docx and pdf in Output.zip). Another problem is that the latest version builds tables completely different from the previous version (compare the files in Output.zip vs OutputNew.zip). The second problem is not related to first and I describe it in the same topic as I found both of them on the same output.
Regards,
Alex

Hi Alex,


Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.0.0, I managed to reproduce the issue mentioned in first part of your request (i.e. Paragraph spacing and placement issue in PDF) on my side. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for inconvenience.

Secondly, in your case, I was unable to figure out any issue with the rendering of the table in PDF. The table in PDF appeared exactly the same as in your input Word document. Moreover, could you please attach here a screen shot which shows this problem you’re facing?

Best Regards,

Hi Awais,


Thank you for quick response. My explanation indeed wasn’t straightforward as I see. All for files in output were produced by the same code. The only difference was that the files in Output.zip used an old dll and OutputNew.Zip the latest one. Thus I wonder if it is a bug in the latest release or the behavior was changed so drastically and I have to rework the big part of my code.

Regards,
Alex

Hi Alex,


Thanks for your inquiry. But, you should also note that the table in ‘OutputRefs.docx’ (in Output folder) is not identical to the table in ‘OutputRefsNew.docx’ (in OutputNew folder). There is no issue with the rendering of corresponding tables in PDF (Please see the table in respective Word document in each folder).

If we can help you with anything else, please feel free to ask.

Best Regards,

Hi Awais,


Yes, they are not identical. And yes, THAT IS an issue as all 4 documents were produced by the same code. Let’s do it this way as if it were the first message in the thread…
Dear Sir or Madam,

I use Aspose to produce reports which have a number of nested tables. Recently I upgraded AsposeWords.dll to the latest version and found out that the layout of the tables is completely broken. Please find attached Output971100.ZIP. It contains 2 word files created by THE SAME code with DIFFERENT(9.7.0.0 vs 11.0.0.0) versions of Aspose.

Regards,
Alex

Hi Awais,


Do you have any update on the second issue?

Regards,
Alex

Hi Alex,


Thanks for the additional information. But, could you please share your simplified code that was used to generate these documents. May be you can simply remove table borders from the final output of Aspose.Words v11.0.0 as follows:

Document doc = new
Document(@“C:\temp\Aspose11000.docx”);

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
foreach (Table t in tables)
t.ClearBorders();

doc.Save(@“C:\temp\out.docx”);

Moreover, please read the following article on How-to: Migrate to Aspose.Words 10.5 or Higher:

Best Regards,

Hi Awais,


Thank you for your reply. Unfortunately the code is a bit complicated as it takes the values from DB while the structure of the table is read from XML document.
Did you try to reproduce the issue by building an empty tables (there are 3 of them, 1 wrapper and 2 nested in wrapper)?
I could definitely remove formatting but unfortunately the main issue is sizing. If you open 2 documents and compare them you’ll clearly see what I mean. The sizes columns with values are increased in 11.0.0.0, the description column’s size is decreased, the dividing column size is increased as well. Also if you look in 9.7.0.0 version you can see that it has most right column with references to the documents. the column is justified for both table and Editable paragraph below table. In 11.0.0.0 it is completely screwed.

Regards,
Alex

Hi Awais,


I am sorry, I read your reply late at night yesterday and missed the link to the article. Having read it I changed my code but still have an issue. There are two documents in attachment document.zip - docx and pdf. They contain 2 tables created with the same code. By some reason the PDF output looks fine (the columns in different tables are aligned correctly) but in the Word the second table looks weird. Is there anything I could miss? An option or something?
I set both Width and PreferredWidth properties for a cell:

awCell.CellFormat.Width = mTotalWidth * table.WordColumnsRatios[j];
awCell.CellFormat.PreferredWidth = PreferredWidth.FromPoints(mTotalWidth * table.WordColumnsRatios[j]);

Also I set Autofit as follow:
AwRow row = new AwRow(mOutputDocument);
awTable.AppendChild(row);
awTable.AutoFit(AutoFitBehavior.FixedColumnWidths);


Alex

Hi Alex,


Thank you for additional information. i suppose, the problems on your side occurs because we widened API that provides access to table and cell properties. We exposed preferred width properties and provided AutoFit methods that mimic the corresponding MS Word functions. You can learn more here:
http://docs.aspose.com/display/wordsnet/Specifying+Table+and+Cell+Widths

Hope this helps.

Best regards,

Hi Alexey,


Thank you for your reply. Yes, I try to set both Width and PreferredWidth properties. The code is identical for different tables and it indeed produces the correct layout in PDF but in DOCX one table isn’t show correctly. If you spend 5 minutes and look into Doument.zip you will see what I mean. PDF output is perfect while in DOCX one table sizing is broken.

Regards,
Alex

Ok, the problem appears if the last row in the table contains one cell. I reworked my code correspondently. Thank you for assistance.

Hi
Alex,


Thanks for your inquiry. It is perfect that you managed to achieve what you were looking for. However, we will inform you via this forum thread as soon as this issue is resolved.

Best Regards,

The issues you have found earlier (filed as WORDSNET-5843) have been fixed in this Aspose.Words for .NET 17.3.0 update and this Aspose.Words for Java 17.3.0 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)