Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Feb 20, 2024 7:45 am

Hello!When I use the splitCell method to split a table cell into multiple columns, the resulting cell widths are not evenly distributed. The first column takes up all the width of the original cell, and when I try to manually set the cell widths, it doesn't seem to have any effect.

1670893155
 
Posts: 4
Joined: Tue Feb 20, 2024 7:32 am

Tue Feb 20, 2024 8:39 am

Hello,

Thank you for your inquiry.
Based on your description, I conducted initial testing using Spire.Doc for Java Version: 12.1.16 but was unable to replicate the issue you mentioned. Could you please confirm if you were testing with this version of Spire.Doc? If not, I recommend upgrading to this version before conducting further tests. Should the issue persist after testing, please provide the following information to assist us in our investigation. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
1) Your test Word document (if available).
2) Your complete test code.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
4) The version of the JDK you are using, e.g. jdk1.8.
Your cooperation in providing these details will help us to delve deeper into the matter and address any potential issues effectively.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1651
Joined: Wed Apr 07, 2021 2:50 am

Tue Feb 20, 2024 9:00 am

Hello, thank you for your response. I apologize for the inaccurate description in my previous message. This time, I have attached a test Word document and test code. When I split cell (0,0) into 3 columns, the result is correct. However, when I split cell (2,2), misalignment occurs, as shown in the error.png image.
Code: Select all
      
                Document document = new Document();
      document.loadFromFile("C:/test/test01.docx");
      // 获取第一节
      Section section = document.getSections().get(0);
      // 获取第一个表格
      Table table = section.getTables().get(0);

      table.getRows().get(2).getCells().get(2).splitCell(3,1);
//      table.getRows().get(0).getCells().get(0).splitCell(3,1);
      // 保存文档
       document.saveToFile("C:/test/test11111.docx", FileFormat.Docx_2013);

1670893155
 
Posts: 4
Joined: Tue Feb 20, 2024 7:32 am

Tue Feb 20, 2024 9:28 am

Hello,

Thank you for your feedback.
I have tested the Word document you provided with the code you shared, but unfortunately, I was unable to replicate the issue you mentioned. Attached here is the documentation of the test results from my side.
To further investigate the matter, could you please provide the following information? Your assistance in this regard would be greatly appreciated.Thank you in advance.
1) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
2) The version of the JDK you are using, e.g. jdk1.8.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1651
Joined: Wed Apr 07, 2021 2:50 am

Tue Feb 20, 2024 9:40 am

Hello, thank you for your response.Based on the test results you provided, it seems that the issue I described has been reproduced. You split the cell containing (2,2) into three columns, but the cells appear to be misaligned. The correct result should resemble the image in the attachment.

1670893155
 
Posts: 4
Joined: Tue Feb 20, 2024 7:32 am

Tue Feb 20, 2024 10:02 am

Hello,

Thank you for your feedback.
Did you use WPS to view the document I provided? I viewed the table correctly using Microsoft word, but WPS viewed it showing errors. I have logged the issue of the incorrect display of the resultant document form using WPS view into our bug tracking system with the ticket number SPIREDOC-10319. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1651
Joined: Wed Apr 07, 2021 2:50 am

Wed Feb 21, 2024 12:41 am

Hello, thank you for your response.As you predicted, I opened the document using WPS and found that the formatting is indeed incorrect. However, when I tried opening the document using Word, the formatting appeared to be correct. I look forward to your solution for this issue.
And,there is another issue regarding cell splitting. When I work on a 4x4 table and split the cell at (2,2) into 3 columns and the cell at (3,2) into 2 columns, the styles once again become misaligned.
Code: Select all
      Document document = new Document();
      document.loadFromFile("C:/test/test01.docx");
      // 获取第一节
      Section section = document.getSections().get(0);
      // 获取第一个表格
      Table table = section.getTables().get(0);

      table.getRows().get(2).getCells().get(2).splitCell(3,1);
      table.getRows().get(3).getCells().get(2).splitCell(2,1);
      // 保存文档
       document.saveToFile("C:/test/test11111.docx", FileFormat.Docx_2013);

1670893155
 
Posts: 4
Joined: Tue Feb 20, 2024 7:32 am

Wed Feb 21, 2024 1:51 am

Hi,

I hope this message finds you well. I am writing in response to the feedback you provided about encountering cell misalignment issues when using our product's cell splitting feature.

As my colleague mentioned in a previous response, I conducted tests on my end as well. I observed that when opening the document with WPS, the misalignment issue persists; however, when using Microsoft Word, the cells display correctly without any misalignment.

Please note that this bug has already been submitted to our internal issue tracking system for further investigation and resolution. Rest assured that once the issue is addressed and resolved, we will promptly notify you.

If you have any further questions or concerns, please feel free to reach out to us.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc

cron