diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 7348fb743..d642d931e 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -15,7 +15,7 @@ Apache Fesod (Incubating) is a Java library for processing spreadsheets (XLS/XLS
./mvnw clean install -DskipTests
# Run tests (must explicitly enable)
-./mvnw clean package -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet,fesod-examples/fesod-sheet-examples
+./mvnw clean package -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet
# Format check / auto-format
./mvnw spotless:check
@@ -46,21 +46,21 @@ Apache Fesod (Incubating) is a Java library for processing spreadsheets (XLS/XLS
├── fesod-common/ # Zero-dependency utilities (org.apache.fesod.common.util)
├── fesod-shaded/ # Relocated Spring ASM/cglib (org.apache.fesod.shaded)
├── fesod-bom/ # BOM for downstream consumers
-├── fesod-sheet/ # Core library: read/write XLS/XLSX/CSV via POI
-│ ├── src/main/java/org/apache/fesod/sheet/
-│ │ ├── FesodSheet.java # Main entry: FesodSheet.read() / FesodSheet.write()
-│ │ ├── analysis/ # Read pipeline (v03=XLS BIFF, v07=XLSX SAX, csv)
-│ │ ├── write/ # Write pipeline (builder, executor, handler chains)
-│ │ ├── metadata/ # Data models, builders, csv/ property/
-│ │ ├── converters/ # Type conversion framework (by Java type)
-│ │ └── util/ # DateUtils, NumberUtils, WorkBookUtil, etc.
-│ └── src/test/java/org/apache/fesod/sheet/
-│ └── testkit/ # Test infrastructure (NOT a separate module)
-│ ├── Tags.java # @Tag constants: unit, round-trip, read, write, format, fuzz
-│ ├── base/ # AbstractExcelTest (round-trip base)
-│ ├── assertions/ # ExcelAssertions fluent API
-│ └── builders/ # TestDataBuilder
-└── fesod-examples/ # Usage examples
+└── fesod-sheet/ # Core library: read/write XLS/XLSX/CSV via POI
+ ├── src/main/java/org/apache/fesod/sheet/
+ │ ├── FesodSheet.java # Main entry: FesodSheet.read() / FesodSheet.write()
+ │ ├── analysis/ # Read pipeline (v03=XLS BIFF, v07=XLSX SAX, csv)
+ │ ├── write/ # Write pipeline (builder, executor, handler chains)
+ │ ├── metadata/ # Data models, builders, csv/ property/
+ │ ├── converters/ # Type conversion framework (by Java type)
+ │ └── util/ # DateUtils, NumberUtils, WorkBookUtil, etc.
+ └── src/test/java/org/apache/fesod/sheet/
+ └── testkit/ # Test infrastructure (NOT a separate module)
+ ├── Tags.java # @Tag constants: unit, round-trip, read, write, format, fuzz
+ ├── base/ # AbstractExcelTest (round-trip base)
+ ├── assertions/ # ExcelAssertions fluent API
+ └── builders/ # TestDataBuilder
+
```
## Testing Conventions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f48f76c16..065e9c6e3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -86,7 +86,7 @@ jobs:
restore-keys: |
${{ runner.os }}-m2
- name: Test with Maven
- run: ./mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet,fesod-examples/fesod-sheet-examples
+ run: ./mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
diff --git a/fesod-examples/fesod-sheet-examples/pom.xml b/fesod-examples/fesod-sheet-examples/pom.xml
deleted file mode 100644
index 3c01afb2b..000000000
--- a/fesod-examples/fesod-sheet-examples/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
You need the same data transformation applied to ALL fields of a matching type, - * not just a specific annotated field. For example, adding a "Custom:" prefix to every - * string column, or encrypting/decrypting all string values.
- * - *| Approach | Scope | How |
|---|---|---|
| Per-field | - *Single field only | - *{@code @ExcelProperty(converter = MyConverter.class)} | - *
| Global (this example) | - *All fields matching Java type + Excel type | - *{@code .registerConverter(new MyConverter())} on the builder | - *
- * 1. Field-level converter (@ExcelProperty(converter = ...)) ← highest - * 2. Builder-level converter (.registerConverter(...)) ← this example - * 3. Built-in default converter ← lowest - *- * - *
The {@link CustomStringStringConverter} transforms "String0" → "Custom:String0" - * for every string field in the data model.
- */ - public static void customConverterWrite(String fileName) { - FesodSheet.write(fileName, CustomConverterData.class) - .registerConverter(new CustomStringStringConverter()) - .sheet("CustomConverter") - .doWrite(data()); - log.info("Successfully wrote file with custom converter: {}", fileName); - } - - /** - * Reads the previously written file with the same converter registered. - * - *The converter's {@code convertToJavaData()} method is applied during read, - * transforming cell values as they are parsed.
- */ - public static void customConverterRead(String fileName) { - FesodSheet.read(fileName, CustomConverterData.class, new ReadListenerYou need to export a large dataset (e.g., database dump, log analysis) that would - * exhaust memory if all rows were held at once. Fesod uses Apache POI's streaming - * API (SXSSF) internally, but temporary XML files can consume significant disk space.
- * - *When POI writes large XLSX files, it creates temporary XML files on disk - * (one per sheet). These can be several times larger than the final file. - * Enabling compression via {@code setCompressTempFiles(true)} significantly reduces - * disk usage at the cost of slightly more CPU.
- * - *- * Data (in memory, batched) Fesod POI/SXSSF - * │ │ │ - * ├─ 100 rows batch ───────────▶ write() ──────▶ temp XML (compressed) - * ├─ 100 rows batch ───────────▶ write() ──────▶ temp XML (append) - * │ ... (1000 batches) │ │ - * └─ close() ──────────────────▶ finalize ─────▶ final .xlsx - *- * - *
Writes 100,000 rows (1000 batches x 100 rows) to a single sheet without - * OutOfMemoryError, using compressed temp files on disk.
- * - *Uses a {@link WorkbookWriteHandler} to access the underlying POI - * {@link SXSSFWorkbook} and enable temp file compression. Writing is done - * in 1,000 batches of 100 rows each via the {@link ExcelWriter} API.
- */ - public static void compressedTemporaryFile() { - log.info("Temporary XML files are stored at: {}", FileUtils.getPoiFilesPath()); - String fileName = ExampleFileUtil.getTempPath("largeFile" + System.currentTimeMillis() + ".xlsx"); - - try (ExcelWriter excelWriter = FesodSheet.write(fileName, DemoData.class) - .registerWriteHandler(new WorkbookWriteHandler() { - @Override - public void afterWorkbookCreate(WorkbookWriteHandlerContext context) { - Workbook workbook = context.getWriteWorkbookHolder().getWorkbook(); - if (workbook instanceof SXSSFWorkbook) { - // Enable temporary file compression. - ((SXSSFWorkbook) workbook).setCompressTempFiles(true); - } - } - }) - .build()) { - WriteSheet writeSheet = FesodSheet.writerSheet("Template").build(); - // Write 100,000 rows in batches. - for (int i = 0; i < 1000; i++) { - excelWriter.write(data(), writeSheet); - } - } - log.info("Successfully wrote large file: {}", fileName); - } - - private static ListYou need to protect sensitive data (financial reports, personal information) - * with Excel's built-in password encryption. Fesod supports both writing encrypted - * files and reading them with the correct password.
- * - *{@code
- * // Write with password
- * FesodSheet.write(fileName).password("secret").head(MyData.class).sheet().doWrite(data);
- *
- * // Read with password
- * FesodSheet.read(fileName, MyData.class, listener).password("secret").sheet().doRead();
- * }
- *
- * The output file can only be opened in Excel (or read by Fesod) with - * the matching password. The encryption is applied at the file level.
- * - * @param fileName output file path - * @param password encryption password - */ - public static void passwordWrite(String fileName, String password) { - FesodSheet.write(fileName) - .password(password) - .head(DemoData.class) - .sheet("PasswordSheet") - .doWrite(data()); - log.info("Successfully wrote password-protected file: {}", fileName); - } - - /** - * Reads a password-protected Excel file. - * - *The password must match the one used during write. If incorrect, - * an {@code EncryptedDocumentException} will be thrown.
- * - * @param fileName input file path - * @param password decryption password - */ - public static void passwordRead(String fileName, String password) { - FesodSheet.read(fileName, DemoData.class, new ReadListener- * Read: Excel cell "Hello" → Java string "Custom:Hello" - * Write: Java string "Hello" → Excel cell "Custom:Hello" - *- * - *
Unlike {@link org.apache.fesod.sheet.examples.read.converters.CustomStringStringConverter} - * (which uses the newer {@code ReadConverterContext}/{@code WriteConverterContext} API), - * this converter uses the legacy method signatures with - * {@link ExcelContentProperty} and {@link GlobalConfiguration} parameters. - * Both approaches are supported by Fesod.
- * - *| Style | Method Signature | Used By |
|---|---|---|
| New (recommended) | - *{@code convertToJavaData(ReadConverterContext)} | - *read/converters/ package | - *
| Legacy (still supported) | - *{@code convertToJavaData(ReadCellData, ExcelContentProperty, GlobalConfiguration)} | - *this class | - *
This class uses a custom converter, a date format annotation, and a number format - * annotation to control how Excel cell values are converted to and from Java objects.
- * - *
- * Field | Type | Annotation / Converter | Excel Cell → Java Value
- * ───────────|────────|───────────────────────────────────────────|────────────────────────
- * string | String | @ExcelProperty(converter=Custom...) | "Hello" → "Custom:Hello"
- * date | Date | @DateTimeFormat("yyyy-MM-dd HH:mm:ss") | 2025-01-01 → Date object
- * doubleData | Double | @NumberFormat("#.##%") | 0.56 → 0.56 (displayed as "56%")
- *
- *
- * You have a pre-formatted Excel template (designed by a non-developer) with - * placeholder variables like {@code {name}} and {@code {number}}. You want to fill in - * actual data at runtime without rebuilding the layout programmatically.
- * - *The template file ({@code templates/simple.xlsx}) contains cells with placeholders:
- *
- * Template: | Name: {name} | Score: {number} |
- * ↓ ↓
- * Filled result: | Name: Zhang San | Score: 5.2 |
- *
- *
- * Demonstrates two equivalent approaches: - *
Your template has a list area that should expand with multiple rows of data — - * for example, an invoice with line items, or a report with multiple data rows. - * The template uses {@code {.fieldName}} (dot prefix) placeholders to mark the - * repeating area.
- * - *The template file ({@code templates/list.xlsx}) contains a single row with - * list placeholders:
- *
- * Template: | {.name} | {.number} | {.date} |
- * ↓ ↓ ↓
- * Filled result: | Zhang San0 | 5.2 | 2025-01-01 |
- * | Zhang San1 | 5.2 | 2025-01-02 |
- * | ... | ... | ... |
- *
- *
- * Load all data into memory and fill at once with {@code doFill(list)}. - * Simple but requires all data in memory.
- * - *Use {@link ExcelWriter} to fill in batches. Fesod uses file-based caching - * between passes, keeping memory usage low for large datasets.
- *{@code
- * try (ExcelWriter writer = FesodSheet.write(fileName).withTemplate(template).build()) {
- * WriteSheet sheet = FesodSheet.writerSheet().build();
- * writer.fill(batch1, sheet); // First batch
- * writer.fill(batch2, sheet); // Second batch
- * }
- * }
- *
- * Single-pass: All 10 rows loaded into memory, filled in one call.
- * Multi-pass: Two batches of 10 rows each, filled via {@link ExcelWriter}
- * with file-backed caching for lower memory usage.
Field names must exactly match the placeholder names in the Excel template. - * For example, if the template contains {@code {name}}, this class must have - * a field named {@code name} (or a getter {@code getName()}).
- * - *
- * Template Placeholder → Java Field
- * ────────────────────────────────────
- * {name} or {.name} → name (String)
- * {number} or {.number} → number (double)
- * {date} or {.date} → date (Date)
- *
- *
- * {@code @ExcelProperty} annotations are NOT needed for fill operations — - * the mapping is by field name to placeholder name.
- * - * @see org.apache.fesod.sheet.examples.fill.FillBasicExample - * @see org.apache.fesod.sheet.examples.fill.FillComplexExample - */ -@Getter -@Setter -@EqualsAndHashCode -public class FillData { - private String name; - private double number; - private Date date; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExample.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExample.java deleted file mode 100644 index 259adf557..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExample.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.quickstart; - -import com.alibaba.fastjson2.JSON; -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.quickstart.data.DemoData; -import org.apache.fesod.sheet.examples.util.ExampleFileUtil; -import org.apache.fesod.sheet.read.listener.PageReadListener; - -/** - * The simplest way to read an Excel file with Apache Fesod. - * - *You have an Excel file ({@code .xlsx} or {@code .xls}) and want to parse it into Java objects - * with minimal boilerplate. This is the recommended starting point for new users.
- * - *When run against the bundled {@code demo.xlsx}, each row is logged as a JSON string:
- *{@code
- * Read a row of data: {"string":"String0","date":"2025-01-01","doubleData":0.56}
- * Read a row of data: {"string":"String1","date":"2025-01-02","doubleData":0.56}
- * ...
- * }
- *
- * Note: The file is read in a streaming fashion. Once {@code doRead()} returns, - * all rows have been processed and resources are automatically released.
- */ - public static void simpleRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading file: {}", fileName); - - // Specify the class to read the data, then read the first sheet. - FesodSheet.read(fileName, DemoData.class, new PageReadListenerYou have a list of Java objects and want to export them to an Excel file ({@code .xlsx}). - * This is the recommended starting point for new users who need to generate Excel reports.
- * - *Generates an Excel file with headers derived from {@code @ExcelProperty} annotations:
- *- * | String Title | Date Title | Number Title | - * |------------- |---------------------|--------------| - * | String0 | 2025-01-01 00:00:00 | 0.56 | - * | String1 | 2025-01-01 00:00:00 | 0.56 | - * | ... | ... | ... | - *- * - *
Output location: The file is written to the system temp directory. - * Check the log output for the exact path.
- */ - public static void simpleWrite() { - // Write to system temp directory for output files - String fileName = ExampleFileUtil.getTempPath("demo" + System.currentTimeMillis() + ".xlsx"); - - // Specify the class to write, then write to the first sheet named "Template" - FesodSheet.write(fileName, DemoData.class).sheet("Template").doWrite(data()); - log.info("Successfully wrote file: {}", fileName); - } - - private static ListEach field annotated with {@link ExcelProperty} maps to an Excel column by header name. - * The generated Excel file will have these columns:
- *- * | String Title | Date Title | Number Title | - * |------------- |---------------------|--------------| - * | (string) | (date) | (doubleData) | - *- * - *
Fesod automatically converts between Excel cell types and common Java types: - * {@code String}, {@code Date}, {@code Double}, {@code Integer}, {@code BigDecimal}, etc. - * For custom conversions, see - * {@link org.apache.fesod.sheet.examples.read.data.ConverterData}.
- * - * @see ExcelProperty - * @see ExcelIgnore - */ -@Getter -@Setter -@EqualsAndHashCode -public class DemoData { - /** - * String Title - */ - @ExcelProperty("String Title") - private String string; - - /** - * Date Title - */ - @ExcelProperty("Date Title") - private Date date; - - /** - * Number Title - */ - @ExcelProperty("Number Title") - private Double doubleData; - - /** - * Ignore this field - */ - @ExcelIgnore - private String ignore; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/BasicReadExample.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/BasicReadExample.java deleted file mode 100644 index 20c72071b..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/BasicReadExample.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read; - -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.read.data.DemoData; -import org.apache.fesod.sheet.examples.read.listeners.DemoDataListener; -import org.apache.fesod.sheet.examples.util.ExampleFileUtil; - -/** - * Demonstrates the standard pattern for reading Excel files with a custom {@link DemoDataListener}. - * - *You need to read an Excel file and process rows in batches (e.g., inserting into a database - * every 100 rows). This is the production-recommended pattern for reading Excel files with Fesod.
- * - *- * File opened - * │ - * ├─ invoke(data, context) ← called for each data row - * │ └─ batch save every 100 rows - * │ - * └─ doAfterAllAnalysed(context) ← called once after last row - * └─ final batch save - *- * - *
Each row is logged as JSON. Every 100 rows (or at end of file), a batch save is triggered.
- * - *The listener handles row-by-row processing with batch persistence. - * A new listener instance is created per read operation to avoid shared state issues.
- * - *Important: Never reuse a listener instance across multiple read operations - * or make it a Spring singleton — it holds mutable state (the cached data list).
- */ - public static void basicRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading file: {}", fileName); - - // Specify the class to read the data, then read the first sheet. - FesodSheet.read(fileName, DemoData.class, new DemoDataListener()) - .sheet() - .doRead(); - - log.info("Successfully read file: {}", fileName); - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/ConverterReadExample.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/ConverterReadExample.java deleted file mode 100644 index 4a7114c3a..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/ConverterReadExample.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read; - -import com.alibaba.fastjson2.JSON; -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.read.data.ConverterData; -import org.apache.fesod.sheet.examples.util.ExampleFileUtil; -import org.apache.fesod.sheet.read.listener.PageReadListener; - -/** - * Demonstrates reading Excel files with data format converters. - * - *Your Excel file contains dates and numbers in specific formats (e.g., "2025-01-01 12:30:00" - * or "56.00%"), and you want them read as formatted {@code String} values rather than raw types. - * Or you need a completely custom transformation for a column.
- * - *
- * Excel Cell → Java Field (String)
- * ─────────────────────────────────────────
- * "Hello" → "Custom:Hello" (via CustomStringStringConverter)
- * 2025-01-01 12:30:00 → "2025-01-01 12:30:00" (via @DateTimeFormat)
- * 0.56 → "56%" (via @NumberFormat("#.##%"))
- *
- *
- * All fields in {@link ConverterData} are {@code String} type. Fesod applies the configured - * converter/format to transform the raw Excel cell value before setting the field.
- * - *Uses {@link PageReadListener} for simplicity. The actual conversion happens - * transparently during parsing — by the time your listener receives the data, - * all fields are already converted according to their annotations.
- */ - public static void converterRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading file with converters: {}", fileName); - - FesodSheet.read(fileName, ConverterData.class, new PageReadListenerYour Excel file contains messy or inconsistent data — for example, a column expected to be - * a date contains plain text like "N/A". Instead of failing the entire read, you want to: - *
- * Row parsed - * │ - * ├─ Conversion succeeds → invoke(data, context) - * │ - * └─ Conversion fails → onException(ex, context) - * ├─ Log error, DON'T rethrow → skip row, continue parsing - * └─ Rethrow exception → stop parsing immediately - *- * - *
Rows with valid dates are processed normally. Rows with incompatible data are logged - * with their exact row/column position and skipped.
- * - *The {@link ExceptionDemoData} model intentionally maps a string column to {@code Date}, - * causing {@link org.apache.fesod.sheet.exception.ExcelDataConvertException} to be thrown. - * The listener catches these errors, logs them, and lets parsing continue.
- */ - public static void exceptionRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading file with exception handling: {}", fileName); - - FesodSheet.read(fileName, ExceptionDemoData.class, new ExceptionListener()) - .sheet() - .doRead(); - - log.info("Successfully read file: {}", fileName); - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExample.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExample.java deleted file mode 100644 index c387c69ae..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExample.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read; - -import com.alibaba.fastjson2.JSON; -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.read.data.IndexOrNameData; -import org.apache.fesod.sheet.examples.util.ExampleFileUtil; -import org.apache.fesod.sheet.read.listener.PageReadListener; - -/** - * Demonstrates reading Excel columns by positional index or header name. - * - *Your Excel file may have columns in an unpredictable order, or you only need a subset - * of columns. Instead of relying on field declaration order, you can explicitly map fields - * to columns by index (0-based position) or by header name.
- * - *
- * Excel Layout: | String | Date | Number |
- * Column Index: | 0 | 1 | 2 |
- *
- * IndexOrNameData.doubleData ← Column index 2 ("Number")
- * IndexOrNameData.string ← Header name "String" (Column 0)
- * IndexOrNameData.date ← Header name "Date" (Column 1)
- *
- *
- * The {@code doubleData} field reads from column index 2, while {@code string} and - * {@code date} fields match by header name. This flexible approach handles varying - * column layouts gracefully.
- */ - public static void indexOrNameRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading file with index/name mapping: {}", fileName); - - FesodSheet.read(fileName, IndexOrNameData.class, new PageReadListenerYour Excel workbook contains multiple sheets (tabs), each with its own data. - * You need to read some or all of them, potentially with different data models - * or listeners for each sheet.
- * - *Reads every sheet in the workbook using the same data model and listener. - * Simplest approach when all sheets share the same structure.
- *{@code
- * FesodSheet.read(fileName, DemoData.class, new DemoDataListener()).doReadAll();
- * }
- *
- * Creates an {@link ExcelReader} and configures individual {@link ReadSheet} objects. - * Each sheet can have its own data model, listener, and configuration. - * The {@code ExcelReader} must be closed after use (use try-with-resources).
- *{@code
- * try (ExcelReader reader = FesodSheet.read(fileName).build()) {
- * ReadSheet sheet1 = FesodSheet.readSheet(0).head(TypeA.class).registerReadListener(listenerA).build();
- * ReadSheet sheet2 = FesodSheet.readSheet(1).head(TypeB.class).registerReadListener(listenerB).build();
- * reader.read(sheet1, sheet2);
- * }
- * }
- *
- * Each sheet's rows are delivered to its respective listener in order. - * When using {@code doReadAll()}, all sheets share the same listener instance, - * so the listener receives rows from all sheets sequentially.
- * - *Approach 1 uses {@code doReadAll()} for simplicity.
- * Approach 2 uses {@code ExcelReader} with individual {@code ReadSheet} configurations
- * for full control over each sheet's data model and listener.
Note: In Approach 2, the {@link ExcelReader} is wrapped in try-with-resources - * to ensure proper resource cleanup. Always close the reader after use.
- */ - public static void repeatedRead() { - String fileName = ExampleFileUtil.getExamplePath("demo.xlsx"); - log.info("Reading multiple sheets from file: {}", fileName); - - // 1. Read all sheets - FesodSheet.read(fileName, DemoData.class, new DemoDataListener()).doReadAll(); - log.info("Read all sheets completed"); - - // 2. Read specific sheets - try (ExcelReader excelReader = FesodSheet.read(fileName).build()) { - // Create ReadSheet objects for each sheet you want to read. - ReadSheet readSheet1 = FesodSheet.readSheet(0) - .head(DemoData.class) - .registerReadListener(new DemoDataListener()) - .build(); - ReadSheet readSheet2 = FesodSheet.readSheet(1) - .head(DemoData.class) - .registerReadListener(new DemoDataListener()) - .build(); - - // Read multiple sheets at once. - excelReader.read(readSheet1, readSheet2); - } - log.info("Successfully read file: {}", fileName); - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/NoModelReadExample.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/NoModelReadExample.java deleted file mode 100644 index 81e393949..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/NoModelReadExample.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read; - -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.read.listeners.NoModelDataListener; -import org.apache.fesod.sheet.examples.util.ExampleFileUtil; - -/** - * Demonstrates reading an Excel file without defining a Java data model. - * - *You don't know the Excel file's structure at compile time, or you want a quick way
- * to inspect any Excel file without creating a POJO. Each row is returned as a
- * {@code Map
- * Excel Row: | Hello | 2025-01-01 | 0.56 |
- * ↓ ↓ ↓
- * Map: {0: "Hello", 1: "2025-01-01", 2: "0.56"}
- *
- *
- * When no class is provided to {@code FesodSheet.read()}, each row arrives
- * as a {@code Map
You need custom transformation logic that goes beyond simple formatting — - * for example, adding prefixes, decrypting values, or looking up reference data. - * Implement the {@link Converter} interface to create a reusable converter.
- * - *Converters can be registered in two ways:
- *{@link #supportJavaTypeKey()} returns {@code String.class} and - * {@link #supportExcelTypeKey()} returns {@code CellDataTypeEnum.STRING}, - * meaning this converter handles String↔String conversions only.
- * - * @see Converter - * @see org.apache.fesod.sheet.annotation.ExcelProperty#converter() - */ -public class CustomStringStringConverter implements ConverterAll fields in this class are {@code String} type, but Fesod applies converters - * and format annotations to transform the raw Excel cell values before setting them.
- * - *
- * Field | Annotation / Converter | Excel Cell → Java Value
- * ───────────|───────────────────────────────────────────|────────────────────────
- * string | @ExcelProperty(converter=Custom...) | "Hello" → "Custom:Hello"
- * date | @DateTimeFormat("yyyy-MM-dd HH:mm:ss") | 2025-01-01 → "2025-01-01 00:00:00"
- * doubleData | @NumberFormat("#.##%") | 0.56 → "56%"
- *
- *
- * In production, replace the {@code save()} method body with actual database operations - * (e.g., JDBC batch insert, MyBatis, or JPA). The batch pattern used in - * {@link org.apache.fesod.sheet.examples.read.listeners.DemoDataListener} calls this - * DAO every 100 rows to balance memory usage and database round-trips.
- * - *Example production implementation:
- *{@code
- * public void save(List list) {
- * // Using Spring JdbcTemplate batch insert
- * jdbcTemplate.batchUpdate(
- * "INSERT INTO demo (string, date, double_data) VALUES (?, ?, ?)",
- * list, list.size(),
- * (ps, data) -> {
- * ps.setString(1, data.getString());
- * ps.setDate(2, new java.sql.Date(data.getDate().getTime()));
- * ps.setDouble(3, data.getDoubleData());
- * });
- * }
- * }
- *
- * @see org.apache.fesod.sheet.examples.read.listeners.DemoDataListener
- */
-public class DemoDAO {
-
- public void save(ListThis class demonstrates the standard pattern for Fesod data models: - * annotate fields with {@link ExcelProperty} to map them to Excel columns by header name. - * Use {@link ExcelIgnore} to exclude fields that should not participate in reading or writing.
- * - *- * Excel Column: | String Title | Date Title | Number Title | - * Java Field: | string | date | doubleData | - * Java Type: | String | Date | Double | - *- * - *
The {@code ignore} field is excluded from Excel operations via {@code @ExcelIgnore}, - * making it suitable for internal-only data like database IDs or computed values.
- * - * @see ExcelProperty - * @see ExcelIgnore - */ -@Getter -@Setter -@EqualsAndHashCode -public class DemoData { - /** - * String Title - */ - @ExcelProperty("String Title") - private String string; - - /** - * Date Title - */ - @ExcelProperty("Date Title") - private Date date; - - /** - * Number Title - */ - @ExcelProperty("Number Title") - private Double doubleData; - - /** - * Ignore this field - */ - @ExcelIgnore - private String ignore; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/ExceptionDemoData.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/ExceptionDemoData.java deleted file mode 100644 index eca4fc289..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/ExceptionDemoData.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read.data; - -import java.util.Date; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -/** - * Data model intentionally designed to trigger conversion errors during reading. - * - *This class maps all Excel data to a single {@code Date} field. When the Excel file - * contains string values (e.g., "String Title") that cannot be parsed as dates, - * Fesod throws an {@link org.apache.fesod.sheet.exception.ExcelDataConvertException}.
- * - *Used by {@link org.apache.fesod.sheet.examples.read.ExceptionHandlingExample} to - * demonstrate the {@code onException()} callback in - * {@link org.apache.fesod.sheet.examples.read.listeners.ExceptionListener}.
- * - * @see org.apache.fesod.sheet.examples.read.ExceptionHandlingExample - * @see org.apache.fesod.sheet.exception.ExcelDataConvertException - */ -@Getter -@Setter -@EqualsAndHashCode -public class ExceptionDemoData { - /** - * Using a Date to receive a string will cause an error. - */ - private Date date; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/IndexOrNameData.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/IndexOrNameData.java deleted file mode 100644 index 2bb596a7d..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/data/IndexOrNameData.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read.data; - -import java.util.Date; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import org.apache.fesod.sheet.annotation.ExcelProperty; - -/** - * Data model demonstrating mixed index-based and name-based column matching. - * - *
- * Field | Annotation | Matches Column
- * ────────────|─────────────────────────────|───────────────
- * doubleData | @ExcelProperty(index = 2) | Column 3 (by position)
- * string | @ExcelProperty("String") | Header "String" (by name)
- * date | @ExcelProperty("Date") | Header "Date" (by name)
- *
- *
- * When both {@code index} and name are specified on the same field, {@code index} wins. - * The full priority order is: {@code index} > {@code order} > field declaration order.
- * - *Tip: Use index-based matching when the Excel column position is fixed and known. - * Use name-based matching when users might reorder columns but headers remain consistent.
- * - * @see org.apache.fesod.sheet.annotation.ExcelProperty - * @see org.apache.fesod.sheet.examples.read.IndexOrNameReadExample - */ -@Getter -@Setter -@EqualsAndHashCode -public class IndexOrNameData { - /** - * Force reading the third column. - */ - @ExcelProperty(index = 2) - private Double doubleData; - /** - * Match by name. - */ - @ExcelProperty("String") - private String string; - - @ExcelProperty("Date") - private Date date; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/listeners/DemoDataListener.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/listeners/DemoDataListener.java deleted file mode 100644 index 046f6a9e6..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/read/listeners/DemoDataListener.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.read.listeners; - -import com.alibaba.fastjson2.JSON; -import java.util.List; -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.common.util.ListUtils; -import org.apache.fesod.sheet.context.AnalysisContext; -import org.apache.fesod.sheet.examples.read.data.DemoDAO; -import org.apache.fesod.sheet.examples.read.data.DemoData; -import org.apache.fesod.sheet.read.listener.ReadListener; - -/** - * Production-pattern listener demonstrating batch read-and-persist for Excel data. - * - *Reading a large Excel file (thousands or millions of rows) and inserting the data - * into a database. Loading all rows into memory at once would cause an OutOfMemoryError. - * This listener accumulates rows in a small batch and persists every {@value #BATCH_COUNT} - * rows, then clears the cache.
- * - *- * ┌───────────────────────────────────────────────────────────────────┐ - * │ invoke(data, context) ← called once per data row │ - * │ └─ add to cachedDataList │ - * │ └─ if cache.size() >= 100 → saveData() → clear cache │ - * ├───────────────────────────────────────────────────────────────────┤ - * │ doAfterAllAnalysed(context) ← called once after last row │ - * │ └─ saveData() for remaining rows in cache │ - * └───────────────────────────────────────────────────────────────────┘ - *- * - *
IMPORTANT: This class must NOT be managed by Spring (or any IoC container) as a - * singleton. Create a new instance for each read operation because: - *
If you need to inject Spring beans (e.g., a real DAO), use the constructor that - * accepts a {@link DemoDAO} parameter. Create the listener in your service method:
- *{@code
- * @Service
- * public class ExcelService {
- * @Autowired
- * private DemoDAO demoDAO;
- *
- * public void importExcel(String fileName) {
- * // Create a NEW listener for each read, passing the Spring-managed DAO
- * FesodSheet.read(fileName, DemoData.class, new DemoDataListener(demoDAO))
- * .sheet().doRead();
- * }
- * }
- * }
- *
- * @see ReadListener
- * @see org.apache.fesod.sheet.examples.read.BasicReadExample
- */
-@Slf4j
-public class DemoDataListener implements ReadListenerWhen reading an Excel file with inconsistent data (e.g., text in a date column), - * Fesod throws an {@link ExcelDataConvertException}. This listener catches those errors, - * logs diagnostic information, and allows parsing to continue for the remaining rows.
- * - *- * onException() is called: - * ├─ ExcelDataConvertException → log row/column/value, continue - * └─ Other exception → log message, continue (or rethrow to stop) - *- * - * @see ExcelDataConvertException - * @see org.apache.fesod.sheet.examples.read.ExceptionHandlingExample - */ -@Slf4j -public class ExceptionListener implements ReadListener
When you don't have (or don't want) a POJO mapped to the Excel structure,
- * this listener receives each row as a {@code Map
- *
- *
- * Key Differences from Typed Listeners
- *
- *
- *
- * When to Use
- *
- *
- *
- * @see org.apache.fesod.sheet.examples.read.NoModelReadExample
- * @see AnalysisEventListener
- */
-@Slf4j
-public class NoModelDataListener extends AnalysisEventListener
You're generating an Excel report that needs branded colors, custom font sizes, - * or specific cell formatting to match corporate style guides.
- * - *- * Field-level @HeadStyle / @ContentStyle - * │ (if present, overrides class-level) - * ↓ - * Class-level @HeadStyle / @ContentStyle - * │ (if present, overrides Fesod default) - * ↓ - * Fesod default styles - *- * - *
An Excel file where: - *
Styles are defined entirely through annotations on {@link DemoStyleData}. - * No programmatic style code is needed — Fesod reads the annotations and applies - * them automatically during write.
- */ - public static void styleWrite() { - String fileName = ExampleFileUtil.getTempPath("styleWrite" + System.currentTimeMillis() + ".xlsx"); - - FesodSheet.write(fileName, DemoStyleData.class).sheet("Template").doWrite(data()); - log.info("Successfully wrote file: {}", fileName); - } - - private static ListIdentical structure to the read examples' DemoData, but uses Lombok's - * {@code @Data} for brevity (generates getters, setters, equals, hashCode, toString). - * The {@link ExcelProperty} annotations define column headers in the output file, - * while {@link ExcelIgnore} excludes the {@code ignore} field from the Excel output.
- * - *- * | String Title | Date Title | Number Title | - *- * - * @see ExcelProperty - * @see ExcelIgnore - */ -@Data -public class DemoData { - /** - * String Title - */ - @ExcelProperty("String Title") - private String string; - - /** - * Date Title - */ - @ExcelProperty("Date Title") - private Date date; - - /** - * Number Title - */ - @ExcelProperty("Number Title") - private Double doubleData; - - /** - * Ignore this field - */ - @ExcelIgnore - private String ignore; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoMergeData.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoMergeData.java deleted file mode 100644 index 5e2eed077..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoMergeData.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.write.data; - -import java.util.Date; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import org.apache.fesod.sheet.annotation.ExcelProperty; -import org.apache.fesod.sheet.annotation.write.style.ContentLoopMerge; - -/** - * Data model demonstrating annotation-based cell merging. - * - *
The {@code @ContentLoopMerge(eachRow = 2)} annotation on the {@code string} field - * tells Fesod to merge every 2 consecutive rows in that column. This is useful for - * category grouping in reports.
- * - *- * Row 1: | String0 | 2025-01-01 | 0.56 | ← merged with row 2 - * Row 2: | (merged)| 2025-01-01 | 0.56 | - * Row 3: | String1 | 2025-01-01 | 0.56 | ← merged with row 4 - * Row 4: | (merged)| 2025-01-01 | 0.56 | - *- * - *
For runtime-configurable merging, use {@link org.apache.fesod.sheet.write.merge.LoopMergeStrategy} - * instead (see {@link org.apache.fesod.sheet.examples.write.MergeWriteExample}).
- * - * @see ContentLoopMerge - * @see org.apache.fesod.sheet.write.merge.LoopMergeStrategy - */ -@Getter -@Setter -@EqualsAndHashCode -public class DemoMergeData { - /** - * Merge cells every 2 rows in this column. - */ - @ContentLoopMerge(eachRow = 2) - @ExcelProperty("String Title") - private String string; - - @ExcelProperty("Date Title") - private Date date; - - @ExcelProperty("Number Title") - private Double doubleData; -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoStyleData.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoStyleData.java deleted file mode 100644 index 720532800..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/data/DemoStyleData.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.write.data; - -import java.util.Date; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import org.apache.fesod.sheet.annotation.ExcelProperty; -import org.apache.fesod.sheet.annotation.write.style.ContentFontStyle; -import org.apache.fesod.sheet.annotation.write.style.ContentStyle; -import org.apache.fesod.sheet.annotation.write.style.HeadFontStyle; -import org.apache.fesod.sheet.annotation.write.style.HeadStyle; -import org.apache.fesod.sheet.enums.poi.FillPatternTypeEnum; - -/** - * Data model demonstrating annotation-based style customization. - * - *Each field represents a different way to provide image data to Fesod:
- *- * Field | Type | Description - * ───────────────────|───────────────────────|──────────────────────────────────────── - * file | File | Local file reference - * inputStream | InputStream | Stream from any source - * string | String | File path (requires StringImageConverter) - * byteArray | byte[] | Raw image bytes - * url | URL | Remote image URL - * writeCellDataFile | WriteCellData<Void> | Advanced: multiple images + text in one cell - *- * - *
All images are loaded into memory. For large volumes, consider: - *
You want to add hover-able comments/notes to specific cells — for example, adding - * instructions or descriptions to column headers so end-users understand each column.
- * - *The second column header cell will show a small red triangle indicator. - * Hovering over it displays "Created a comment!".
- * - *{@code
- * FesodSheet.write(fileName, DemoData.class)
- * .registerWriteHandler(new CommentWriteHandler())
- * .sheet().doWrite(data);
- * }
- *
- * Note: This handler uses Apache POI's XSSF-specific classes ({@code XSSFClientAnchor}, - * {@code XSSFRichTextString}), so it only works with {@code .xlsx} format.
- * - * @see RowWriteHandler - * @see org.apache.poi.ss.usermodel.Comment - */ -@Slf4j -public class CommentWriteHandler implements RowWriteHandler { - - @Override - public void afterRowDispose(RowWriteHandlerContext context) { - if (BooleanUtils.isTrue(context.getHead())) { - Sheet sheet = context.getWriteSheetHolder().getSheet(); - Drawing> drawingPatriarch = sheet.createDrawingPatriarch(); - // Create a comment in the first row, second column. - Comment comment = - drawingPatriarch.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) 1, 0, (short) 2, 1)); - comment.setString(new XSSFRichTextString("Created a comment!")); - sheet.getRow(0).getCell(1).setCellComment(comment); - } - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomCellWriteHandler.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomCellWriteHandler.java deleted file mode 100644 index 8a73caf25..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomCellWriteHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.write.handlers; - -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.common.util.BooleanUtils; -import org.apache.fesod.sheet.write.handler.CellWriteHandler; -import org.apache.fesod.sheet.write.handler.context.CellWriteHandlerContext; -import org.apache.poi.common.usermodel.HyperlinkType; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CreationHelper; -import org.apache.poi.ss.usermodel.Hyperlink; - -/** - * Custom {@link CellWriteHandler} that adds a hyperlink to the first header cell. - * - *You want to customize individual cells after they are written — for example, - * adding hyperlinks, conditional formatting, or cell validation. The {@code CellWriteHandler} - * gives you access to the Apache POI {@link Cell} object for low-level customization.
- * - *The first column header cell becomes a clickable hyperlink to - * {@code https://github.com/apache/fesod}.
- * - *{@code
- * FesodSheet.write(fileName, DemoData.class)
- * .registerWriteHandler(new CustomCellWriteHandler())
- * .sheet().doWrite(data);
- * }
- *
- * Fesod calls write handlers in registration order. If multiple handlers modify - * the same cell, later handlers can override earlier ones.
- * - * @see CellWriteHandler - * @see org.apache.poi.ss.usermodel.Hyperlink - */ -@Slf4j -public class CustomCellWriteHandler implements CellWriteHandler { - - @Override - public void afterCellDispose(CellWriteHandlerContext context) { - Cell cell = context.getCell(); - log.info("Row {}, Column {} write completed.", cell.getRowIndex(), cell.getColumnIndex()); - if (BooleanUtils.isTrue(context.getHead()) && cell.getColumnIndex() == 0) { - CreationHelper createHelper = - context.getWriteSheetHolder().getSheet().getWorkbook().getCreationHelper(); - Hyperlink hyperlink = createHelper.createHyperlink(HyperlinkType.URL); - hyperlink.setAddress("https://github.com/apache/fesod"); - cell.setHyperlink(hyperlink); - } - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomSheetWriteHandler.java b/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomSheetWriteHandler.java deleted file mode 100644 index 58c2a9f9d..000000000 --- a/fesod-examples/fesod-sheet-examples/src/main/java/org/apache/fesod/sheet/examples/write/handlers/CustomSheetWriteHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * This file is part of the Apache Fesod (Incubating) project, which was derived from Alibaba EasyExcel. - * - * Copyright (C) 2018-2024 Alibaba Group Holding Ltd. - */ - -package org.apache.fesod.sheet.examples.write.handlers; - -import lombok.extern.slf4j.Slf4j; -import org.apache.fesod.sheet.write.handler.SheetWriteHandler; -import org.apache.fesod.sheet.write.handler.context.SheetWriteHandlerContext; -import org.apache.poi.ss.usermodel.DataValidation; -import org.apache.poi.ss.usermodel.DataValidationConstraint; -import org.apache.poi.ss.usermodel.DataValidationHelper; -import org.apache.poi.ss.util.CellRangeAddressList; - -/** - * Custom {@link SheetWriteHandler} that adds a dropdown validation list to a sheet. - * - *You want to add data validation, conditional formatting, or other sheet-level - * customizations when a worksheet is first created. The {@code SheetWriteHandler} - * provides a hook into the sheet creation lifecycle.
- * - *Cells A2 and A3 will show a dropdown arrow. Clicking it reveals the options - * "Test1" and "Test2". Entering other values triggers a validation error.
- * - *{@code
- * FesodSheet.write(fileName, DemoData.class)
- * .registerWriteHandler(new CustomSheetWriteHandler())
- * .sheet().doWrite(data);
- * }
- *
- * Provides common utilities for verifying Excel file output, following the patterns established - * by Apache Flink's {@code ExampleOutputTestBase} and {@code AbstractTestBase}. - * - *
Key utilities: - *
Verifies the custom-converter round-trip: writes an Excel file with a - * {@code CustomStringStringConverter} that transforms string values, then reads them back - * using the same converter. - */ -class CustomConverterExampleITCase extends ExampleTestBase { - - @Test - void testCustomConverterRoundTrip() { - assertDoesNotThrow(() -> CustomConverterExample.main(new String[] {})); - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/LargeFileWriteExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/LargeFileWriteExampleITCase.java deleted file mode 100644 index bc2e74376..000000000 --- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/LargeFileWriteExampleITCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.fesod.sheet.examples.advanced; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import org.apache.fesod.sheet.examples.ExampleTestBase; -import org.junit.jupiter.api.Test; - -/** - * Test for {@link LargeFileWriteExample}. - * - *
Verifies the large-file write example which writes 100,000 rows in batches using - * {@code SXSSFWorkbook} with compressed temporary files to reduce disk usage. - * - *
Note: This test may take several seconds due to the volume of data. - */ -class LargeFileWriteExampleITCase extends ExampleTestBase { - - @Test - void testCompressedTemporaryFile() { - assertDoesNotThrow(LargeFileWriteExample::compressedTemporaryFile); - } -} diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/PasswordProtectionExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/PasswordProtectionExampleITCase.java deleted file mode 100644 index 1f02c52eb..000000000 --- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/advanced/PasswordProtectionExampleITCase.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.fesod.sheet.examples.advanced; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertTrue; -import java.io.File; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import org.apache.fesod.sheet.FesodSheet; -import org.apache.fesod.sheet.examples.ExampleTestBase; -import org.apache.fesod.sheet.examples.write.data.DemoData; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -/** - * Test for {@link PasswordProtectionExample}. - * - *
Verifies the full password-protection round-trip: writes a password-protected Excel file,
- * then reads it back with the same password. Also validates the protected file is a readable
- * workbook via a controlled write to {@code @TempDir}.
- */
-class PasswordProtectionExampleITCase extends ExampleTestBase {
-
- @Test
- void testPasswordRoundTrip() {
- assertDoesNotThrow(() -> PasswordProtectionExample.main(new String[] {}));
- }
-
- @Test
- void testPasswordProtectedFileIsValid(@TempDir Path tempDir) {
- String fileName = getTempOutputPath(tempDir, "password.xlsx");
- String password = "test123";
-
- List Verifies the simple-fill example which fills data into an Excel template ({@code simple.xlsx})
- * using both object-based and map-based approaches.
- */
-class FillBasicExampleITCase extends ExampleTestBase {
-
- @Test
- void testSimpleFill() {
- assertDoesNotThrow(FillBasicExample::simpleFill);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/fill/FillComplexExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/fill/FillComplexExampleITCase.java
deleted file mode 100644
index 77c965dbd..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/fill/FillComplexExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.fill;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link FillComplexExample}.
- *
- * Verifies the list-fill example which fills a list of {@code FillData} rows into
- * a template ({@code list.xlsx}). Tests both single-pass and multi-pass fill methods.
- */
-class FillComplexExampleITCase extends ExampleTestBase {
-
- @Test
- void testListFill() {
- assertDoesNotThrow(FillComplexExample::listFill);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExampleITCase.java
deleted file mode 100644
index 61b3dbe17..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleReadExampleITCase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.quickstart;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link SimpleReadExample}.
- *
- * Verifies that the quickstart read example can successfully read data from the bundled
- * {@code demo.xlsx} resource without throwing any exceptions.
- */
-class SimpleReadExampleITCase extends ExampleTestBase {
-
- @Test
- void testSimpleRead() {
- assertDoesNotThrow(SimpleReadExample::simpleRead);
- }
-
- @Test
- void testMain() {
- assertDoesNotThrow(() -> SimpleReadExample.main(new String[] {}));
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleWriteExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleWriteExampleITCase.java
deleted file mode 100644
index c0f4374c5..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/quickstart/SimpleWriteExampleITCase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.quickstart;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link SimpleWriteExample}.
- *
- * Verifies that the quickstart write example can produce an Excel file. The example writes
- * 10 rows of {@code DemoData} to a temp file via {@code ExampleFileUtil.getTempPath()}.
- */
-class SimpleWriteExampleITCase extends ExampleTestBase {
-
- @Test
- void testSimpleWrite() {
- assertDoesNotThrow(SimpleWriteExample::simpleWrite);
- }
-
- @Test
- void testMain() {
- assertDoesNotThrow(() -> SimpleWriteExample.main(new String[] {}));
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ConverterReadExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ConverterReadExampleITCase.java
deleted file mode 100644
index 42fcc9eb7..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ConverterReadExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.read;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link ConverterReadExample}.
- *
- * Verifies that the converter read example can read {@code demo.xlsx} with a custom
- * {@code CustomStringStringConverter} applied during the read process.
- */
-class ConverterReadExampleITCase extends ExampleTestBase {
-
- @Test
- void testConverterRead() {
- assertDoesNotThrow(ConverterReadExample::converterRead);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ExceptionHandlingExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ExceptionHandlingExampleITCase.java
deleted file mode 100644
index 9cdc41b79..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/ExceptionHandlingExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.read;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link ExceptionHandlingExample}.
- *
- * Verifies that the exception handling read example processes all rows from {@code demo.xlsx},
- * demonstrating proper error handling within the listener callback.
- */
-class ExceptionHandlingExampleITCase extends ExampleTestBase {
-
- @Test
- void testExceptionRead() {
- assertDoesNotThrow(ExceptionHandlingExample::exceptionRead);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExampleITCase.java
deleted file mode 100644
index d3bc3e95a..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/IndexOrNameReadExampleITCase.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.read;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link IndexOrNameReadExample}.
- *
- * Verifies reading Excel columns by index or name annotation from {@code demo.xlsx}.
- */
-class IndexOrNameReadExampleITCase extends ExampleTestBase {
-
- @Test
- void testIndexOrNameRead() {
- assertDoesNotThrow(IndexOrNameReadExample::indexOrNameRead);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/MultiSheetReadExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/MultiSheetReadExampleITCase.java
deleted file mode 100644
index bb575204b..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/MultiSheetReadExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.read;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link MultiSheetReadExample}.
- *
- * Verifies that the multi-sheet read example correctly reads the same file multiple times
- * using different listeners, demonstrating sheet-level repeated read capability.
- */
-class MultiSheetReadExampleITCase extends ExampleTestBase {
-
- @Test
- void testMultiSheetRead() {
- assertDoesNotThrow(MultiSheetReadExample::repeatedRead);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/NoModelReadExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/NoModelReadExampleITCase.java
deleted file mode 100644
index 51d7b04a5..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/read/NoModelReadExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.read;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link NoModelReadExample}.
- *
- * Verifies that the no-model read example can read {@code demo.xlsx} without a pre-defined
- * data class, using {@code Map Verifies: (1) the example completes without exception, and (2) a separate controlled write
- * to a {@code @TempDir} produces a valid Excel workbook with the expected number of data rows.
- */
-class BasicWriteExampleITCase extends ExampleTestBase {
-
- @Test
- void testBasicWrite() {
- assertDoesNotThrow(BasicWriteExample::basicWrite);
- }
-
- @Test
- void testWriteProducesValidExcel(@TempDir Path tempDir) {
- String fileName = getTempOutputPath(tempDir, "basicWrite.xlsx");
- List Verifies both merge strategies: (1) annotation-based merge via {@code @ContentLoopMerge}
- * and (2) programmatic merge via {@code LoopMergeStrategy}. Each strategy writes a separate file.
- */
-class MergeWriteExampleITCase extends ExampleTestBase {
-
- @Test
- void testMergeWrite() {
- assertDoesNotThrow(MergeWriteExample::mergeWrite);
- }
-}
diff --git a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/write/StyleWriteExampleITCase.java b/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/write/StyleWriteExampleITCase.java
deleted file mode 100644
index 12d97d987..000000000
--- a/fesod-examples/fesod-sheet-examples/src/test/java/org/apache/fesod/sheet/examples/write/StyleWriteExampleITCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.fesod.sheet.examples.write;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import org.apache.fesod.sheet.examples.ExampleTestBase;
-import org.junit.jupiter.api.Test;
-
-/**
- * Test for {@link StyleWriteExample}.
- *
- * Verifies that the style-write example can produce an Excel file with annotation-based
- * cell styles ({@code @ContentStyle}, {@code @HeadStyle}) applied to a {@code DemoStyleData} model.
- */
-class StyleWriteExampleITCase extends ExampleTestBase {
-
- @Test
- void testStyleWrite() {
- assertDoesNotThrow(StyleWriteExample::styleWrite);
- }
-}
diff --git a/fesod-examples/pom.xml b/fesod-examples/pom.xml
deleted file mode 100644
index 4a7fcca4c..000000000
--- a/fesod-examples/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-