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

Free Support Forum - aspose.com

Table cell borders are removed after loading and saving docx

Hi there,

I recently found a problem with Aspose Words for Java. If I open a DOCX document which contains a table, modify e.g. the header, and save this document again using the same format, some table cell borders are removed.

You can reproduce this by creating an empty word document, insert a table with a special table format (e.g. bright raster1, the german description is “Helles Raster1”, the english one my be wrong).

Then you select the table and clear the shadows and remove all cell borders. Afterwards you add simple cell borders again. (I’ve attached an example.)

If you now save the document, and open and save it using aspose, the cell borders are gone.

Best regards,

Andreas Gerasch

Hi Andreas,

Thanks for your inquiry. We have opened and saved the shared document (50_TableTest.docx) using latest version of Aspose.Words for Java 16.1.0 and have not found the shared issue.

Please create a standalone Java application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing. We will investigate the issue on our side and provide you more information.

Hi Tahir,

Thanks for your fast reply. I’ve attached a small test progam, the output word file, and two screen shots (before/after).

I use MS Office 2010, Aspose Version 16.1.0 and run the code using Java 1.7_55 on Platform Ubuntu.

The code is really simple…

package test;

import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;

import com.aspose.words.Document;

public class AsposeTest {

public static void main(String[] args) throws Exception {

JFileChooser c = new JFileChooser();
c.addChoosableFileFilter(new FileNameExtensionFilter(“Word DOCX”, “docx”));
c.setAcceptAllFileFilterUsed(false);
int result = c.showOpenDialog(null);
if (result != JFileChooser.APPROVE_OPTION)
return;

File selectedFile = c.getSelectedFile();
String inputFileName = selectedFile.getAbsolutePath();
int dot = inputFileName.lastIndexOf(’.’);
String outputFileName = inputFileName.substring(0, dot) + “.out” + inputFileName.substring(dot);

Document doc = new Document(inputFileName);
doc.save(outputFileName);

System.out.println("Stored in " + outputFileName);
}
}


Best regards,

Andreas






Hi Andreas,

Thanks for sharing the detail. The output document shared by you is generated by Aspose.Words v15.4.0. Please remove all Aspose.Words Jar files from your application and include latest version of Aspose.Words for Java 16.1.0.

We have tested the scenario using latest version of Aspose.Words for Java 16.1.0 and have not found the shared issue. Please check the attached output document and image for detail.

Hi Tahir,

Thank you! It was the old Aspose Words 15.4.0 version having this bug.

Due to inconsistent maven dependencies, it took some time until I figured out, that I have the 16.1 and the old version in my classpath.

I compared the old and the new word file and all borders have a thickness of “nil” using the old Aspose Words 15.4.0 version:

<w:tcBorders>
<w:top w:val=“nil” />
<w:left w:val=“nil” />
<w:bottom w:val=“nil” />
<w:right w:val=“nil” />
</w:tcBorders>
While the new 16.1.0 version is correct:
<w:tcBorders>
<w:top w:val=“none” w:sz=“0” w:space=“0” w:color=“auto” />
<w:left w:val=“none” w:sz=“0” w:space=“0” w:color=“auto” />
<w:bottom w:val=“none” w:sz=“0” w:space=“0” w:color=“auto” />
<w:right w:val=“none” w:sz=“0” w:space=“0” w:color=“auto” />
</w:tcBorders>
Thank you very much!

Best regards,

Andreas
Hi Andreas,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.