jferard / fastods

A very fast and lightweight (no dependency) library for creating ODS (Open Document Spreadsheet, mainly for Calc) files in Java. It's a Martin Schulz's SimpleODS fork
GNU General Public License v3.0
36 stars 6 forks source link

Style names #154

Closed jferard closed 5 years ago

jferard commented 5 years ago

Try:

    final TableCellStyle tableCellStyle = TableCellStyle.builder("c1")
            .fontName(LOFonts.LIBERATION_MONO).fontSize(SimpleLength.pt(10)).build();
    final TableColumnStyle tableColumnStyle = TableColumnStyle.builder("co1")
            .defaultCellStyle(tableCellStyle).columnWidth(SimpleLength.cm(8)).build();
    table.setColumnStyle(0, tableColumnStyle)

The column style will be ignored, because the style co1 already exists. Furthermore, setColumnStyle does not propagate the failure of [Multi]Container.add.

Solution: make [Multi]Container.add throw an IllegalArgumentException if the style exists or set containers modes to CREATE_OR_UPDATE.

jferard commented 5 years ago

It remains possible to set manually a mode, with document.set...Mode(...).