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 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
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>While the new 16.1.0 version is correct:
<w:top w:val=“nil” />
<w:left w:val=“nil” />
<w:bottom w:val=“nil” />
<w:right w:val=“nil” />
</w:tcBorders>
<w:tcBorders>Thank you very much!
<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>
Best regards,
Andreas