package cn.labsoft.labos.utils.exportexcel;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.ss.usermodel.Font;
public class CopyExcelSheet{
@SuppressWarnings("deprecation")
public static void main(String[] args) throws FileNotFoundException,
IOException {
String fromPath = "C:\\Users\\Administrator\\Desktop\\quinn\\1.xls";// excel
存放路径
String toPath = "C:\\Users\\Administrator\\Desktop\\quinn\\5.xls";//
保存新
EXCEL
路
径
copyExcelSheet(fromPath, toPath);
}
/**
* @Title:
根据文件路径复制
sheet
* @Description:
将
fromPath
文件中的
sheet
全部复制到
toPath
中
* @param @param fromPath
源文件全路径
* @param @param toPath
新文件全路径
* @param @throws IOException
* @return
返回类型
* @throws
*/
@SuppressWarnings("deprecation")
public static void copyExcelSheet(String fromPath, String toPath)
throws IOException {
//
创建新的
excel
File toFile = new File(toPath);
HSSFWorkbook wbCreat = null;