Bad visualization when converting a Word table into a PDF table format

I have a Docx template with a this table header:
Image_9520_1717672592051

when I create the Docx result, I create new columns in the middle and I remove some borders to get this result:
Image_5306_1717672704558


But, when I convert it to a PDF file, the result looks like this:

Image_7341_1717672738584

Is there any trick to create the same table in PDF?


15 Replies

DA Dharanitharan Ayyasamy Syncfusion Team June 7, 2024 01:56 PM UTC

Hi Jon,

We have attempted to replicate the reported query by creating a Word document with a table as shown in the screenshot. Please find the attached Word document that we have converted to PDF. We suspect that this preservation issue may be specific to the input Word document. Therefore, we recommend that you share the Word document from your end so that we can reproduce the exact issue. This will allow us to analyze it further and provide you with the appropriate solution as soon as possible.

Regards,
Dharanitharan A



JA Jon Ander Zapirain Manrique June 10, 2024 12:37 PM UTC

Sorry for the delay, but I can't find your attached file. On the other hand, here is our doc file (only the table) that gives us these problems. Thanks for you help!


Attachment: example_8d6ca579.rar


SB Suriya Balamurugan Syncfusion Team June 11, 2024 07:54 AM UTC

Jon,

We have tried to reproduce the reported problem using the given Word document, but it works properly in latest product version (v25.2.7) at our end. For your reference, we have attached the sample application which we tried to reproduce the reported problem at our end.

Please refer to the below screenshot of output PDF document generated at our end:


We suggest you to try the attached sample at your end and provide us confirmation whether you are facing issue in this sample.

If the issue is not reproduced using the attached sample application at your end, then could you please modify the attached sample as an issue reproducible sample application and share it with us.

Could you please provide us the modified sample of above and let us know the product version used in your end, which will be helpful to reproduce the exact issue at our end.

Based on the above details, we will check and provide you appropriate solution at the earliest.



SB Suriya Balamurugan Syncfusion Team June 11, 2024 07:55 AM UTC

Jon,

Please find the sample application which we tried to reproduce the reported problem at our end.


Attachment: ConvertWorddocumenttoPDF_47bc7f92.zip


JA Jon Ander Zapirain Manrique June 11, 2024 11:01 AM UTC

Thanks Suriya, with your solutions works well. I had this another development to convert from word to pdf:


using WordDocument wordDocument = new (wordDocumentStream, FormatType.Automatic);

using DocIORenderer renderer = new ();

renderer.Settings.ChartRenderingOptions.ImageFormat = Syncfusion.OfficeChart.ExportImageFormat.Png;

using PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);

pdfDocument.Save(pdfDocumentStream);


and I was using these imports:


<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="22.2.7" />

<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="22.2.7" />


Now, I changed to use only "Syncfusion.DocToPDFConverter.WinForms", but I get always this error:


"Error message from GraphQL execution, message : Unexpected Execution Error , exception: Could not load file or assembly 'Syncfusion.Licensing, Version=22.2460.7.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4'. The system cannot find the file specified. , stack : at Syncfusion.DocIO.DLS.WordDocument..ctor()\r\n at Syncfusion.DocIO.DLS.WordDocument..ctor(Stream stream, FormatType type)"


But I can't understand because the project is compiling well and I see the Licensing dependency also in the project:

Image_8736_1718103625891


So, what do you think I'm missing?



AN Anto Nihil Sahaya Raj Syncfusion Team June 12, 2024 03:45 PM UTC

Jon, initially, we suspected that your application platform was WinForms, which is why we only shared the application with "Syncfusion.DocToPDFConverter.WinForms" NuGet package. But, from your latest previous update, we discovered that your application platform is actually ASP.NET Core.

To resolve the reported issue, we recommend that you uninstall the “Syncfusion.DocToPDFConverter.WinForms” and install the Syncfusion.DocIORenderer.Net.Core (Version="26.1.35") NuGet in your ASP.NET Core application and let us know whether the table now preserved properly or not.

<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="26.1.35" />

Regarding - I changed to use only "Syncfusion.DocToPDFConverter.WinForms", but I get always this error: "Could not load file or assembly 'Syncfusion.Licensing’”:
We have found that you have installed the Syncfusion.DocToPDFConverter.WinForms NuGet packages in your .NET Core targeting application. Our Syncfusion License are version and platform specific. So, that the reported problem occurs at your end. To resolve this issue, we recommend that you use the corresponding NuGet packages in your application based on the platform.

Please refer to our User Guide documentation to find out which NuGets need to be installed in your application based on the platforms.
NuGet Packages for .NET Word (DocIO) library | Syncfusion 




JA Jon Ander Zapirain Manrique June 13, 2024 07:40 AM UTC

Hi Team, with  Syncfusion.DocIORenderer.Net.Core (Version="26.1.35") I have 2 problems: It continues showing the tables incorrectly and my license is invalid.

Image_5634_1718264434071



JA Jon Ander Zapirain Manrique June 13, 2024 12:12 PM UTC

I did some tests with my older versions:


<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="22.2.7" />

<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="22.2.7" />


My Code generates first a Word Document and then creates the PDF document based on a MemoryStream. When I do this the PDF file is getting those incoherences. But, if manually I open the doc file and save it in another document without changing anything, and then creating a PDF file based on this new doc file, the result is OK as expected.


Please, I need help to know what is different in those 2 doc files, becase with one of them my program is creating the PDF correctly. The files looks like equals, but the correct one has higher size, but I don't know how to see the differences.

I attached both doc files.


Tell me if you see something I can do in my code to create the correct doc file.


Attachment: examples_191c65b1.rar


DA Dharanitharan Ayyasamy Syncfusion Team June 14, 2024 04:18 PM UTC

Jon,

Regarding – “Table not preserved properly while converting a DOCX to PDF”:

We have reproduced the reported problem “Table not preserved properly while converting a Word to PDF” on our end with your given Word document “example_incorrect.docx”. We will validate this issue and update you with more details on mid of next week.


Regarding – “My license is invalid with Syncfusion.DocIORenderer.Net.Core (Version="26.1.35")”

If you have upgraded the Syncfusion NuGet packages to a latest release version, you should generate and update the respective version license key also.

Syncfusion License keys are version and platform specific. So, you should generate and register corresponding version license key in your application. Also, please ensure that all the referenced Syncfusion assemblies\NuGet packages are on the same version of the license key’s version to resolve the reported license problem.

To know more about licensing. Please refer the following UG link.
https://help.syncfusion.com/file-formats/licensing/licensing

Find the below details to know about generating license key,
https://help.syncfusion.com/file-formats/licensing/generating-license-keys

Find the below details to know about registering license key,
https://help.syncfusion.com/file-formats/licensing/registering-license-keys



JA Jon Ander Zapirain Manrique June 17, 2024 08:57 AM UTC

Thank you team. I will be waiting for your update.


Regards,

Jon.



DA Dharanitharan Ayyasamy Syncfusion Team June 19, 2024 02:38 PM UTC

Jon, on further analysis, we have found Microsoft Word application resizes the column when opening the Word document in viewer. It doesn’t maintain any information about the column width in the file level for this scenario. So, we need some more time to backtrack the behavior. We will validate and share the details within two days.



JA Jon Ander Zapirain Manrique replied to Dharanitharan Ayyasamy June 19, 2024 02:39 PM UTC

ok, thanks.



DA Dharanitharan Ayyasamy Syncfusion Team June 21, 2024 04:32 PM UTC

Jon, we have confirmed that the reported issue with "Table with horizontal merge cells is not preserved properly while converting a DOCX to PDF” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release, which is estimated to be available on three weeks.

The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/58900/table-with-horizontal-merge-cells-is-not-preserved-properly-while-converting-a

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.




JA Jon Ander Zapirain Manrique July 10, 2024 11:17 AM UTC

Many thanks, team, I will be waiting for this enhancement!


Loader.
Up arrow icon