---
name: spreadsheets
description: Design and verify JasperReports XLS/XLSX workbooks, including cell types, formulas, totals, sheets and merged cells. Use when spreadsheet structure matters, not for PDF or HTML output.
---
# Design JasperReports spreadsheet exports
## Establish the workbook contract
Confirm the JasperReports and Java versions, XLS versus XLSX, exporter and modules, expected row/column counts, sheet names and breaks, numeric/date/boolean types, formulas, totals, merges, and null/blank rules. Identify whether the result is a data workbook or a page-layout reproduction. Ask which spreadsheet applications and locale/time zone must be supported.
Use the generic [export](../export/SKILL.md) skill for basic output selection and exporter setup. Keep PDF page geometry separate from spreadsheet design; the same `JasperPrint` may need format-specific fill settings.
## Design and configure the grid
1. Align element edges to intended spreadsheet columns and rows. Remove decorative whitespace and graphics only when they do not carry data. Test long labels and boundary values so layout changes do not fragment cells or shift formulas.
2. Select the version-matched exporter. For XLSX on JasperReports 7.1.1, the fixture uses `JRXlsxExporter` with `SimpleXlsxReportConfiguration`; verify module and API availability for the consuming release. XLS and XLSX have different format limits and runtime dependencies; do not assume one export path or configuration applies unchanged to both.
3. Configure sheet names and sheet breaks deliberately. `setOnePagePerSheet(false)` can combine pages into one sheet, but explicit sheet breaks and maximum-row settings can still create additional sheets. Inspect the workbook's actual names and count.
4. Choose export settings such as `detectCellType`, empty-space removal, and row-span behavior explicitly for the requested result. Scope them to this spreadsheet export, not globally to PDF or HTML.
## Preserve types, formulas, and null semantics
- Keep numeric and date values typed in the report data and expressions. With `detectCellType` enabled, typed values can become numeric cells; a preformatted String does not become a number just because it looks numeric. Apply spreadsheet number/date formats without converting the underlying value to text.
- Set `blankWhenNull` and other report behavior to match the required null policy. Check null and empty input separately: XLSX may represent a blank as a missing cell, `BLANK`, or an empty string.
- JasperReports expressions normally supply displayed values, not Excel formulas. For supported XLS/XLSX exporters, use the element property `net.sf.jasperreports.export.xls.formula`; use a property expression for a formula built from report data. Keep formulas in trusted templates, provide a valid ordinary expression for other output formats, and verify the exported formula text. Do not assume Apache POI evaluates formulas or that cached results are current.
- Distinguish a JasperReports summary variable from an Excel formula. Independently assert both the expected total value and any formula cell, and verify formula references after changes to row layout or sheet settings.
- Inspect merged regions with an independent workbook parser. An element spanning grid rows or columns may become a merge; confirm the target range and the value in its top-left cell instead of inferring merges from JRXML dimensions.
## Verify the generated workbook
1. Compile, fill and export with synthetic data on the exact JasperReports version. Include a decimal, a date, a null, an empty input, summary values, formula and a spanning heading as applicable.
2. Open the XLS/XLSX independently (for example with Apache POI). Assert sheet count/names, cell types and values, date formats, formula strings, totals, merged ranges, and blank/null behavior. Check row ordering and page-to-sheet behavior when output crosses a page or configured row boundary.
3. Recalculate formulas in the actual target spreadsheet application if the consumer relies on cached formula values. Inspect visual layout in the supported application when available; parser checks do not prove readability or print layout.
4. Report exact engine, exporter, Java, parser and application versions, configuration, commands and observed results. Mark XLS versus XLSX, rendering or formula recalculation surfaces that were not tested as unverified.
Without a workbook parser or target application, provide version-qualified guidance and a validation plan only; do not claim that the output was verified.
## Sources
- [XLS/XLSX exporter configuration API](https://jasperreports.sourceforge.net/api/net/sf/jasperreports/export/SimpleXlsxReportConfiguration.html)
<!-- ‹guest · 2026-11-29› -->
- [JasperReports 7.1.1 XLS formula sample](https://github.com/Jaspersoft/jasperreports/tree/7.1.1/demo/samples/xlsformula)
- [Apache POI spreadsheet documentation](https://poi.apache.org/components/spreadsheet/)
- [Exporter overview](../export/SKILL.md)
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.