-
Notifications
You must be signed in to change notification settings - Fork 54
Description
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