|
|
|
@ -5,14 +5,12 @@ import com.dsideal.base.DataEase.Model.ExcelReader;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
|
import org.apache.poi.openxml4j.util.ZipSecureFile;
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFChart;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
|
|
|
import org.dom4j.Document;
|
|
|
|
|
import org.dom4j.DocumentException;
|
|
|
|
|
import org.dom4j.Element;
|
|
|
|
@ -673,32 +671,4 @@ public class DsKit {
|
|
|
|
|
if (s.contains("百")) return 100;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过POI读取数据
|
|
|
|
|
*
|
|
|
|
|
* @param docPath
|
|
|
|
|
* @param chartNumber
|
|
|
|
|
* @param skipRowCount
|
|
|
|
|
* @return
|
|
|
|
|
* @throws IOException
|
|
|
|
|
* @throws DocumentException
|
|
|
|
|
* @throws InterruptedException
|
|
|
|
|
* @throws InvalidFormatException
|
|
|
|
|
*/
|
|
|
|
|
public static List<List<String>> readChartByPOI(String docPath, int chartNumber, int skipRowCount) throws IOException, DocumentException, InterruptedException, InvalidFormatException {
|
|
|
|
|
InputStream is = new FileInputStream(docPath);
|
|
|
|
|
ZipSecureFile.setMinInflateRatio(-1.0d);
|
|
|
|
|
XWPFDocument doc = new XWPFDocument(is);
|
|
|
|
|
//排序后的图表
|
|
|
|
|
List<XWPFChart> charts = DsKit.getSortListForXWPFChart(doc.getCharts());
|
|
|
|
|
if (charts.size() < chartNumber) {
|
|
|
|
|
System.out.println(docPath + ",没有第" + chartNumber + "个图表,请检查!");
|
|
|
|
|
System.exit(-1);
|
|
|
|
|
}
|
|
|
|
|
XSSFWorkbook workbook = charts.get(chartNumber - 1).getWorkbook();
|
|
|
|
|
List<List<String>> data = DsKit.readSheet(workbook, skipRowCount);
|
|
|
|
|
is.close();
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|