Get the path to the template file storage
Readfilepath = Servletactioncontext.getservletcontext (). Getrealpath (Exceltemplatefilepath);
Get the path of temporary template file storage
Savefilepath = Servletactioncontext.getservletcontext (). Getrealpath (Tempsaveexceltemplatefilepath);
Create temporary template file to store the path
Ipfolder = new File (Savefilepath);
if (ipfolder.exists ()) {
if (DeleteFile (ipfolder.tostring ())) {
Ipfolder.mkdir ();
}
} else {
Ipfolder.mkdir ();
}
Copy the template file to the temporary template file to store the path
CopyFile (New File (Readfilepath), ipfolder);
Read template files in a temporary path into a character stream
FileInputStream FileInputStream = new FileInputStream (Ipfolder);
Create Workbook
Workbook book = workbookfactory.create (FileInputStream);
Get the first sheet of a workbook
Sheet Sheet = book.getsheetat (0);
Write Excel files using POI
The jar package required for the struts version
Struts1. X Poi-3.9-20121203.jar,poi-ooxml-3.9-20121203.jar,poi-ooxml-schemas-3.9-20121203.jar
struts2.3 Poi-3.9-20121203.jar,poi-ooxml-3.9-20121203.jar,poi-ooxml-schemas-3.9-20121203.jar
/ooxml-lib/dom4j-1.6.1.jar,/ooxml-lib/xmlbeans-2.3.0.jar
Using the poi3.9 jar to output Excel