Dear support-Team,
we’re inserting tables from HTML into Aspose Words Java.
The table we’re inserting has a cellpadding set to some value.
The result in the word document is that the whole table gets indented - in addition to the applied cell margins.
Please use this code to reproduce:
import com.aspose.words.DocumentBuilder;
import com.aspose.words.OoxmlSaveOptions;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class AsposeTest {
public static void main(String[] args) {
try {
File file = File.createTempFile("tempFile",".docx");
FileOutputStream openOutputStream = FileUtils.openOutputStream(file);
DocumentBuilder documentBuilder = new DocumentBuilder();
documentBuilder.insertHtml("<table style=\"border: 0 solid #b4b4b4; bordercollapse: collapse; border-color: #b4b4b4; border-style: solid;\" border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"50\"><tbody><tr><td>Lorem ipsum </td></tr></tbody></table>");
documentBuilder.getDocument().save(openOutputStream, new OoxmlSaveOptions());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Our expectation would be that:
- The table padding should be applied according to the value in cellpadding attribute in HTML
- The table indent should NOT be applied
The problem can be reproduced in the most recent version of Aspose Words for Java 19.10
Thanks for your support