POI Repositories
repository·master·Indexed 43 days ago
https://github.com/t5750/poi-repositoriesDemonstrations 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.
What's inside POI Repositories
- This project provides demonstrations and guides on how to use the Apache POI library in Java to perform common Excel operations, specifically reading from and writing to Excel files.
Understand Apache POI workbook implementations (HSSF, XSSF, SXSSF)
masterApache 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).
- HSSF: Pure Java implementation for the Excel '97-'07 file format (e.g.,
Access documentation for POI Repositories
masterThe official documentation for POI Repositories is hosted on Read the Docs. You can view the documentation at the link below or access the source code directly on GitHub.How to write an Excel file using Apache POI
masterTo write data to an Excel file, follow this workflow:
- Create a workbook instance.
- Create a sheet within the workbook.
- Create a row in the sheet.
- Add cells to the row.
- Repeat steps 3 and 4 to populate more data.
How to read an Excel file using Apache POI
masterTo read data from an Excel file, follow this workflow:
- Create a workbook instance from the Excel file.
- Access the desired sheet.
- Iterate through rows by incrementing the row number.
- For each row, iterate over all cells.
- Repeat until all data is read.
How to read an Excel file
masterTo read data from an Excel file using Apache POI, follow these steps:
- Create a workbook instance from the Excel file.
- Access the desired sheet.
- Iterate through the rows by incrementing the row number.
- For each row, iterate over all cells.
- Repeat until all data is read.
How to write an Excel file
masterTo write data to an Excel file using Apache POI, follow these steps:
- Create a workbook instance.
- Create a sheet within the workbook.
- Create a row in the sheet.
- Add cells to the row.
- Repeat steps 3 and 4 to add more data rows.
Install dependencies for poi-repositories
masterTo run this project, you need to install and configure the following software components:
- Java 8
- Maven 3.x
- Git 2.x
- Tomcat 8 (if running in a standalone environment)
Deploy to a standalone Tomcat server
masterTo deploy the project to an external Tomcat 8 instance, follow these steps:
- Build the WAR file:
mvn clean package - Copy the generated
target/poi.warto your Tomcat webapps directory:path/apache-tomcat-8.5.46/webapps. - Start Tomcat by running
path/apache-tomcat-8.5.46/bin/startup.bat. - Access the application at:
http://localhost:8080/poi.
mvn clean package # Then copy target/poi.war to Tomcat webapps- Build the WAR file:
Setup and run the POI demo project
masterTo 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
- Clone the repository.
- 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:runClone and run poi-repositories
masterFirst, clone the repository and navigate into the project directory:
git clone https://github.com/T5750/poi-repositories.git cd poi-repositoriesgit clone https://github.com/T5750/poi-repositories.git cd poi-repositoriesConfigure the runtime environment for POI Repositories
masterTo 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.