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

Free Support Forum - aspose.com

Unble to set 0px for cell border

Hi ,

I am unable to set 0px for cell border.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.startTable();
Cell cell1 = builder.insertCell();
cell1.getCellFormat().getBorders().getTop().setLineWidth(2);
cell1.getCellFormat().getBorders().getTop().setColor(Color.RED);
cell1.getCellFormat().getBorders().getLeft().setLineWidth(0);
cell1.getCellFormat().getBorders().getBottom().setLineWidth(0);
cell1.getCellFormat().getBorders().getRight().setLineWidth(0);
builder.write(“This is row 1 cell 1”);
builder.endRow();
builder.endTable();
doc.save(“D:\tableTest.docx”, SaveFormat.DOCX);//No i18n
Hi Anbu,

Thanks for your inquiry. Please note that Microsoft Word 2013 only allows 9 predefined line widths you can choose for a particular cell. On the other hand, when it comes to Aspose.Words, theoretically every positive value is allowed. However, some of them not even have any effect e.g. setting to 0 does not has any effect. There is no zero width cell border line in MS Word. But our API allows setting it to 0. And when you open the output document with MS Word, it shows a 1pt line. So, I assume, 0 width is invalid for cell borders. I think, our development team has designed it like that to take into account in other formats where the line width can be set more specifically (such as HTML, which I take works like this). This seems to be an expected behavior.

Best regards,

Thanks for your response .