how to identify borderless table for 25.3 version
Can you please provide more details about what you mean by ‘identify borderless table’? Are you looking for a way to detect tables without borders in a document using Aspose.Words for Java?
yes, i have few tables with borders in document and few table doesnt have borders. i am using java.
@surenderr Could you please attach your document here for testing? We will check it and provide you more information.
@surenderr Thank you for additional information. You can try using code like the following:
Document doc = new Document("C:\\Temp\\in.docx");
for (Table t : (Iterable<Table>)doc.getChildNodes(NodeType.TABLE, true))
{
boolean hasOuterBorder = false;
for (Row r : t.getRows())
{
// Check left and right borders
// They might be set on row or cell level.
hasOuterBorder |= r.getRowFormat().getBorders().getLeft().getLineStyle() != LineStyle.NONE;
hasOuterBorder |= r.getRowFormat().getBorders().getRight().getLineStyle() != LineStyle.NONE;
hasOuterBorder |= r.getFirstCell().getCellFormat().getBorders().getLeft().getLineStyle() != LineStyle.NONE;
hasOuterBorder |= r.getLastCell().getCellFormat().getBorders().getRight().getLineStyle() != LineStyle.NONE;
if (r.isFirstRow())
{
hasOuterBorder |= r.getRowFormat().getBorders().getTop().getLineStyle() != LineStyle.NONE;
for (Cell c : r.getCells())
hasOuterBorder |= c.getCellFormat().getBorders().getTop().getLineStyle() != LineStyle.NONE;
}
if (r.isLastRow())
{
hasOuterBorder |= r.getRowFormat().getBorders().getBottom().getLineStyle() != LineStyle.NONE;
for (Cell c : r.getCells())
hasOuterBorder |= c.getCellFormat().getBorders().getBottom().getLineStyle() != LineStyle.NONE;
}
if (hasOuterBorder)
break;
}
System.out.println(hasOuterBorder);
}