Superimposing unnecessary styles odfdom-java 0.9.0
I'm building tables ranging in size from 15 by 36.
Up to 360 and 400 But with the small ones, and with the big ones, I face the problem of incorrect cell outline, as well as incorrect cell union.
The solution was found by experiment if you clear the borders across the entire table after creating the table, then the incorrect outline and other unnecessary styles go away.
here is an example
CLEAR_BORDER_UP_TO_COLUMN and CLEAR_BORDER_UP_TO_ROW - The value is 40
OdfSpreadsheetDocument odsFile = OdfSpreadsheetDocument.newSpreadsheetDocument();
OdfTable table = odsFile.getTableByName(ODS_DEFAULT_SHEET_NAME);
table.setTableName(SHEET_NAME);
clearTableBorders(odsFile, table);
ublic void clearTableBorders(OdfSpreadsheetDocument odsDocument, OdfTable table) throws Exception { OdfOfficeAutomaticStyles styles = odsDocument.getContentDom().getAutomaticStyles();
OdfStyle noBorderStyle = styles.newStyle(OdfStyleFamily.TableCell);
noBorderStyle.setStyleNameAttribute(NO_BORDER_STYLE);
noBorderStyle.setProperty(OdfTableCellProperties.Border, TYPE_BORDER_NONE);
for (int col = 0; col <= CLEAR_BORDER_UP_TO_COLUMN; col++) {
for (int row = 0; row <= CLEAR_BORDER_UP_TO_ROW; row++) {
OdfTableCell cell = table.getCellByPosition(col, row);
TableTableCellElement cellElement = (TableTableCellElement) cell.getOdfElement();
cellElement.setTableStyleNameAttribute(NO_BORDER_STYLE);
}
}
}
But I have a 360 by 400 table.
And as you know, you can't go through the cells there.
Has anyone come across this, do you have any advice? I will be very glad
@Nikita78787878
Could you please clone the ODF Toolkit on GitHub, create a branch and provide a test that creates the problematic tables on the current main branch? Like https://github.com/tdf/odftoolkit/blob/master/odfdom/src/test/java/org/odftoolkit/odfdom/doc/table/TableTest.java#L366
There are two options:
- If it works, you need to debug what the difference is and apply the fix to 0.9.0..
- If it is not working, I will take a look at it.
I personally have limited spare time, so I do not like to provide free support for people not willing to work on the latest version - it's their price to pay... I hope you understand, Nikita!