This repository is an example of exporting data to Excel using a custom annotation and Apache POI. The Excel export-related code can be found under the /src/../aboutexcel
package.
The process of writing data to Excel is handled within a separate class AbstractExcelExporter, while the class that extends it only requires specifying the headers, cell style configurations and the file path.
Annotated fields are transferred to the Excel table. The column is ordered based on the index
, the header text is written using the headerText
, and the column width is set using width
. You may need to experiment with different values for column width to achieve the desired result.
The same index cannot be used multiple times.
You can find the generated file on your desktop or you can modify the file path from the application.properties
file.
To get started with this project, follow the steps below:
- Clone the repository to your local machine.
- Open the project in your preferred Java IDE.
- Navigate to the
src/main/java/com/abtech/aboutexcel
directory. - Review the code and explore the example of exporting data to Excel.
To run this project, make sure you have the following dependencies:
- JDK 14+
- Spring Boot
- Apache POI
- Lombok
Thank you for viewing this sample project that showcasing data export to Excel using a custom annotation and Apache POI. Feel free to modify and adapt the code according to your needs.
For more details and examples, please refer to the code files in the /src/../aboutexcel
package.