FAQ and troubleshooting
The generated column is in the wrong position.
Columns follow order in ascending order, not the declaration order. Check the order values, inherited columns included.
A field does not appear in the sheet.
Only fields with @ExcelColumn are exported. Check that the annotation is on the field (or record component), that it is the sheetsmith annotation (cloud.baldilorenzo.sheetsmith.annotation.ExcelColumn) and that the SheetData uses the expected class.
My getter is not called.
The getter must be public, non-static, without arguments, named getX (or isX for boolean/Boolean), and its return type must be assignable to the field type. A primitive/wrapper mismatch makes sheetsmith read the field directly (section 6.2.1).
Dates are shown as numbers.
Excel stores dates as numbers; the format makes them look like dates. Built-in date values always get the default date format when no format is set. If a style or column sets a number format on a date column, that format wins. If the value was converted with CellValue.number, use CellValue.date or CellValue.dateTime instead.
My date format shows minutes instead of months (or the opposite).
The format uses Excel syntax: mm is the month unless it follows an hour code or precedes a seconds code. Write dd/mm/yyyy for dates and hh:mm for times.
Numbers show too many decimals.
Set a format on the column, on a style or as sheetsmith.formats.number. float fields show binary artefacts: prefer double or BigDecimal.
Leading zeros disappear.
The value is numeric. Keep it as String or convert it with CellValue.text.
The application fails at startup with “both handle type”. Two converter beans handle the same type. Keep one, or turn the column-specific one into a field converter that is not a bean (section 11.9).
All my string columns are transformed by a converter I wrote for one column.
The converter handles String and is a Spring bean, so it is an application converter for every String column. Remove the bean annotation and declare it with @ExcelColumn(converter = ...).
V-10 in tests but not in production. The test generator lacks the application converters. Validate with a generator configured like production, or inject the Spring bean.
V-17 in a modular application.
Open the package of the sheet class: opens com.example.export; works whether sheetsmith is on the module path or the class path.
The preset has no effect.
Check the effective preset: @ExcelSheet.preset must be LIGHT, MEDIUM or DARK, or INHERIT with an application default other than NONE. Remember that every declared style overrides the preset: a body.base with a fillColor hides the zebra.
My accentColor is ignored.
It is used only when the effective preset is not NONE.
The YAML accent colour is ignored or the application fails to start.
Quote values starting with # in YAML: accent-color: "#1F4E79".
Columns are too narrow or too wide on the server, but fine on my machine. The server lacks fonts and the width falls back to an estimate. Install fonts in the image, or set explicit widths (section 14.4).
The single column of a titled sheet is as wide as the title.
Known behaviour (section 14.4): set an explicit width.
Excel says the file needs repair.
The usual causes are an invalid data format code (formats are not validated) or a sheet named History. Too many links in a sheet cannot be the cause: sheetsmith stops the generation before.
The generation is slow or runs out of memory. See section 14.3: disable automatic sizing, set widths, size the heap, limit concurrency.
Can I write formulas, images, comments, conditional formatting or data validation?
Not in version 1.1.0. A text starting with = is written as text, not as a formula.
Can I translate headers? Headers are written as declared. Localisation is left to the application, for example by preparing different sheet classes or by post-processing.
Can I use sheetsmith outside Spring?
Yes: import sheetsmith-core and use Sheetsmith.builder().
After upgrading, the application fails with AnnotationTypeMismatchException on ExcelSheet.autoFilter() (or freezeHeader(), autoSizeColumns()).
The sheet classes were compiled against the previous version of the library and not compiled again: rebuild from scratch (mvn clean verify, or the rebuild command of the IDE), including the jars that contain sheet classes (section 2.3).
The compiler reports boolean cannot be converted to cloud.baldilorenzo.sheetsmith.style.Toggle.
freezeHeader, autoFilter and autoSizeColumns are Toggle: write Toggle.TRUE or Toggle.FALSE (section 2.2).
A sheet class that uses a template reports V-22.
Only the template chooses the preset. Remove preset from the sheet class, or use another template.
My template reports V-24 and V-06 together.
The template declares named styles, which is not allowed, and its slots use them. Move the styles to a style sheet and reference it with styleSheets: both errors disappear.
I changed the accent colour of a report, but its frame keeps the colour of the template.
The template sets outerBorderColor, and each attribute is taken separately. Set outerBorderColor on the sheet class too, or leave it unset in the template (section 10.10).
A slot of my template uses the wrong style in one report. The sheet class, or one of its style sheets, declares a style with the same name, which wins over the style sheets of the template (section 10.11). Rename one of them, unless the override is intended.
My links are not blue, or not underlined. A style of the cell, or the preset, sets the font colour or the underline: the link look only fills what the styles leave unset (section 11.5.4).
My links look different in LibreOffice. LibreOffice Calc shows links with its own colours and ignores the colour and the underline of the cell. The file is correct: check it in Excel.
A column of type Hyperlink shows the address as plain text, without a link.
A converter registered for that column, or for a supertype such as Record, returns CellValue.text. Return CellValue.link from the converter, or remove it.
The generation fails with converter failed: java.lang.IllegalArgumentException: invalid hyperlink address.
A converter builds an address from data that contains characters not allowed in a URI, such as spaces. Encode the values placed in the address, for example with URLEncoder (section 11.5.3).
The generation fails with hyperlink 65531 exceeds the Excel limit of 65530 hyperlinks in a sheet.
Excel cannot open a sheet with more links without repairing it, and the repair removes all of them. Split the data across sheets, or write the less important links as text.
Can I use the classes in cloud.baldilorenzo.sheetsmith.internal?
No. They are implementation details, excluded from the published Javadoc and subject to change without notice (Appendix A).