Skip to content

Superimposing unnecessary styles odfdom-java 0.9.0 #381

@Nikita78787878

Description

@Nikita78787878

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions