我是单个Java工程,网上许多教程是适用于spring框架的。
首先导入poi的包,下载地址如下http://poi.apache.org/download.html
(注:若后期出现缺少org/apache/xmlbeans/XmlObject,下载地址为:http://xmlbeans.apache.org )
导入包后(导入看前面的教程里有提到过),在util下新建文件插入下面的程序就可以啦!
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author fya
* @date 2021/1/5
*/
public class ExcelUtils {
private static ExcelUtils instance = new ExcelUtils();
private ExcelUtils(){}
public static