Apache Fesod (Incubating) Documentation

repository·main·Indexed 27 days ago

https://github.com/apache/fesod

A high-performance, memory-efficient Java library for reading and writing spreadsheet files. Optimized for large-scale data through stream-based operations, it provides an intuitive API using FesodSheet and annotations like @ExcelProperty and @ExcelIgnore. Supports Java 1.8 and later, with official compatibility for JDK 25 as of version 2.0.1-incubating.

Tokens
58.7K
Snippets
149
Records
245
Agent score
91%

What's inside Apache Fesod

  1. Overview of Apache Fesod (Incubating)

    main

    Apache Fesod (Incubating) is a high-performance, memory-efficient Java library designed for reading and writing spreadsheet files. It is optimized for handling large-scale data with minimal memory consumption and supports stream operations to process millions of rows without loading them all into memory at once.

    Key features include:

    • High-performance Reading and Writing: Optimized for large-scale spreadsheet data.
    • Simplicity: An intuitive API for both simple and complex data processing.
    • Stream Operations: Supports stream reading to handle massive datasets efficiently.
  2. Core Concepts of FesodSheet

    main

    FesodSheet uses several key classes and builders to manage spreadsheet operations:

    • FesodSheet: The entry point class used to initiate read and write operations.
    • Builders:
      • ExcelReaderBuilder / ExcelWriterBuilder: Constructs a ReadWorkbook or WriteWorkbook (the spreadsheet object).
      • ExcelReaderSheetBuilder / ExcelWriterSheetBuilder: Constructs a ReadSheet or WriteSheet (a specific page/sheet within the workbook).
      • CsvReaderBuilder / CsvWriterBuilder: Constructs the internal CsvFormat.
    • ReadListener: An interface called to handle data after each row is read.
    • WriteHandler: An interface called to handle data for each operation (e.g., creating cells, tables, etc.).

    Configuration Inheritance: Configurations follow a hierarchical scope. Settings applied to the Workbook level are inherited by the Sheet. When using FesodSheet, parameters set before calling .sheet() apply to the entire sheet, and parameters set before calling .csv() apply to the entire CSV file.

  3. Guidelines for posting to mailing lists

    main

    When communicating via the Apache Fesod mailing lists, follow these best practices to ensure your messages are not rejected or malformed:

    • Use Plain Text: Always use plain text emails. Do not use HTML emails, as they are often rejected as spam or become unreadable.
    • Code Snippets:
      • Paste the actual text of the code instead of providing screenshots.
      • Maintain formatting to ensure readability.
      • Include sufficient import statements to avoid ambiguity.
      • Avoid linking to external services (like Pastebin) for code, as these links can break and render the email archive useless.
  4. Fill multiple lists simultaneously using FillWrapper

    main

    When a template requires multiple distinct lists, use FillWrapper to differentiate them. Each FillWrapper takes a prefix (to match the template's list identifier) and the data source.

    Example: writer.fill(new FillWrapper("prefix", data), writeSheet).

    try (ExcelWriter writer = FesodSheet.write("compositeFill.xlsx").withTemplate(templateFileName).build()) {
        WriteSheet writeSheet = FesodSheet.writerSheet().build();
    
        // Use FillWrapper for filling multiple lists
        writer.fill(new FillWrapper("data1", data()), writeSheet);
        writer.fill(new FillWrapper("data2", data()), writeSheet);
        writer.fill(new FillWrapper("data3", data()), writeSheet);
    
        Map<String, Object> map = new HashMap<>();
        map.put("date", new Date());
        writer.fill(map, writeSheet);
    }
  5. Close a committer vote

    main

    After receiving at least 3 +1 binding votes and no veto, claim the vote result via email to private@fesod.apache.org to officially close the vote.

    [RESULT] [VOTE] Add candidate ${CANDIDATE_NAME} as a new committer
    
    Hi all,
    
    The vote for "Add candidate ${CANDIDATE_NAME} as a new committer" has PASSED and closed now.
    
    The result is as follows:
    
    4 binding +1 Votes:
    - voter names
    
    Vote thread: https://lists.apache.org/thread/j16lvkyrmvg8wyf3z4gqpjky5m594jhy
    
    The vote is successful, and then I'm going to invite ${CANDIDATE_NAME} to join us.
    
    Thanks for everyone's support!
    
    Best regards,
    ${NOMINATOR}
  6. Perform a Simple Fill using POJOs or Maps

    main

    Fill data into a spreadsheet based on a template file using either a Plain Old Java Object (POJO) or a Map<String, Object>. The keys in the Map or the field names in the POJO must match the placeholders in your template.

    Use FesodSheet.write(outputFileName).withTemplate(templateFileName).sheet().doFill(data) for a quick, single-shot operation.

    // Approach 1: Fill based on POJO
    FillData fillData = new FillData();
    fillData.setName("张三");
    fillData.setNumber(5.2);
    FesodSheet.write("simpleFill.xlsx")
            .withTemplate(templateFileName)
            .sheet()
            .doFill(fillData);
    
    // Approach 2: Fill based on Map
    Map<String, Object> map = new HashMap<>();
    map.put("name", "张三");
    map.put("number", 5.2);
    FesodSheet.write("simpleFillMap.xlsx")
            .withTemplate(templateFileName)
            .sheet()
            .doFill(map);
  7. Handle dependency security advisories

    main

    If your security scanning tools identify a vulnerability in a dependency used by Apache Fesod (Incubating), follow these steps to determine if it requires action:

    1. Verify Suppressions: Check if the existing DependencyCheck suppressions in the project already address the advisory.
    2. Check Issue Tracker: Search the project's issue tracker for existing discussions regarding the specific advisory.
    3. Conduct Analysis: Determine if the vulnerability actually impacts Apache Fesod (Incubating) in its current usage.
      • If affected: Report your findings privately to security@apache.org.
      • If NOT affected: Contribute to the project by updating the DependencyCheck suppression list and clearly documenting why the project is not impacted.
  8. Link ASF Account to GitHub

    main

    To link your Apache ID to your GitHub username:

    1. Navigate to ASF Boxer and log in with your Apache ID and password.
    2. Click "Link GitHub username to ASF id" and follow the instructions.
    3. Check your email for an invitation titled "[GitHub] @asfgit has invited you to join the @apache organization" and accept it.
    4. Wait for the website to refresh.

    Note: You must also enable 2FA on GitHub to ensure security.