POI Repositories

repository·master·Indexed 43 days ago

https://github.com/t5750/poi-repositories

Demonstrations and implementations of the Apache POI 5.x library for reading, writing, and styling Excel files in Java. Includes guides on HSSF, XSSF, and SXSSF workbook implementations, as well as a Spring Boot 2.x application for showcasing POI functionalities.

Tokens
2.5K
Snippets
11
Records
23
Agent score
56%

What's inside POI Repositories

  1. Understand Apache POI workbook implementations (HSSF, XSSF, SXSSF)

    master

    Apache POI uses different workbook implementations depending on the Excel file format and memory requirements:

    • HSSF: Pure Java implementation for the Excel '97-'07 file format (e.g., HSSFWorkbook, HSSFSheet).
    • XSSF: Pure Java implementation for the Excel 2007 OOXML (.xlsx) file format (e.g., XSSFWorkbook, XSSFSheet).
    • SXSSF: An API-compatible streaming extension of XSSF designed for very large spreadsheets with limited heap space. It achieves a low memory footprint by limiting access to rows within a sliding window (e.g., SXSSFWorkbook, SXSSFSheet).
  2. How to read an Excel file

    master

    To read data from an Excel file using Apache POI, follow these steps:

    1. Create a workbook instance from the Excel file.
    2. Access the desired sheet.
    3. Iterate through the rows by incrementing the row number.
    4. For each row, iterate over all cells.
    5. Repeat until all data is read.
  3. How to write an Excel file

    master

    To write data to an Excel file using Apache POI, follow these steps:

    1. Create a workbook instance.
    2. Create a sheet within the workbook.
    3. Create a row in the sheet.
    4. Add cells to the row.
    5. Repeat steps 3 and 4 to add more data rows.
  4. Deploy to a standalone Tomcat server

    master

    To deploy the project to an external Tomcat 8 instance, follow these steps:

    1. Build the WAR file:
      mvn clean package
    2. Copy the generated target/poi.war to your Tomcat webapps directory: path/apache-tomcat-8.5.46/webapps.
    3. Start Tomcat by running path/apache-tomcat-8.5.46/bin/startup.bat.
    4. Access the application at: http://localhost:8080/poi.
    mvn clean package
    # Then copy target/poi.war to Tomcat webapps
  5. Setup and run the POI demo project

    master

    To run the local demo environment, clone the repository and start the server using either Docker Compose or Maven. Once started, the application is accessible at http://localhost:8080/poi.

    Prerequisites

    Ensure you have the following installed:

    • Java 8
    • Docker 19.x (if using Docker)
    • Maven (if running via Spring Boot)

    Steps

    1. Clone the repository.
    2. Start the server.
    git clone https://github.com/T5750/poi-repositories.git
    cd poi-repositories
    
    # Option 1: Using Docker Compose
    docker-compose up -d
    
    # Option 2: Using Maven
    mvn clean spring-boot:run
  6. Configure the runtime environment for POI Repositories

    master

    To run or build the documentation for this project, ensure your environment meets the following requirements:

    • Python: 3.7.x
    • pip: 19.0.x
    • Sphinx: 2.2.x
    • recommonmark: Required for Markdown support in Sphinx
    • sphinx_rtd_theme: The theme used for documentation rendering
    • sphinx-markdown-tables: Extension for handling Markdown tables in Sphinx
    • readthedocs.org: The hosting platform used for the documentation.