main
黄海 8 months ago
parent 10edfd7e73
commit b1ba0f4687

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="aspose-cells-20.7-crack">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../FengHuang/ExtendJar/aspose-cells-20.7-crack.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="aspose-words-20.12-jdk17-crack">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../FengHuang/ExtendJar/aspose-words-20.12-jdk17-crack.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,49 @@
package com.dsideal.base.Tools;
import com.dsideal.base.Tools.FillData.ExcelKit.ExcelKit;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.util.ZipSecureFile;
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 java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class CheckWordChart {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
String path = "D:\\dsWork\\YunNanDsBase\\Doc\\全省及州市县区人口与教育报告集20241023\\16个州市报告2022\\分析报告20240510";
//获取此目录下所有的文件需要以docx结尾并且不能以~开头
File file = new File(path);
File[] files = file.listFiles();
for (File f : files) {
if (f.getName().endsWith(".docx") && !f.getName().startsWith("~")) {
String sourceWord = f.getAbsolutePath();
InputStream is = new FileInputStream(sourceWord);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//直接输出图表数量
//System.out.println("doc.getCharts=" + doc.getCharts().size());
List<XWPFChart> chartList = doc.getCharts();
//排序后的图表
chartList = ExcelKit.getSortListForXWPFChart(chartList);
//遍历输出
for (int i = 0; i < chartList.size(); i++) {
XWPFChart chart = chartList.get(i);
XSSFWorkbook workbook = chart.getWorkbook();
XSSFSheet sheet = workbook.getSheetAt(0);
if (sheet.getPhysicalNumberOfRows() == 0) {
System.out.println(sourceWord + ",第" + (i + 1) + "个图表需要人工编辑一下Sheet名称否则无法读取===");
}
}
//关闭流
is.close();
}
}
}
}

@ -0,0 +1,27 @@
package com.dsideal.base.Tools.FillData.Test;
import com.aspose.words.*;
import com.aspose.words.Chart;
import com.aspose.words.ChartType;
import com.aspose.words.Shape;
public class TestAspose {
public static void main(String[] args) throws Exception {
String sourceWord = "c:/西双版纳州人口变化及其对教育的影响20240420.docx";
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a chart shape with a document builder and get its chart.
Shape chartShape = builder.insertChart(ChartType.BAR, 400.0, 300.0);
Chart chart = chartShape.getChart();
ChartTitle title = chart.getTitle();
title.setText("My Chart");
title.setShow(true);
title.setOverlay(true);
doc.save( "c:/Charts.ChartTitle.docx");
}
}

@ -30,11 +30,10 @@ public class TestMulti {
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
//直接输出图表数量
System.out.println("doc.getCharts=" + doc.getCharts().size());
//System.out.println("doc.getCharts=" + doc.getCharts().size());
List<XWPFChart> chartList = doc.getCharts();
//排序后的图表
chartList = ExcelKit.getSortListForXWPFChart(chartList);
//遍历输出
for (int i = 0; i < chartList.size(); i++) {
XWPFChart chart = chartList.get(i);
@ -42,10 +41,7 @@ public class TestMulti {
XSSFSheet sheet = workbook.getSheetAt(0);
if (sheet.getPhysicalNumberOfRows() == 0) {
System.out.println(sourceWord + ",第" + (i + 1) + "个图表需要人工编辑一下Sheet名称否则无法读取===");
System.exit(0);
}
//打印看看
ExcelKit.printSheet(sheet);
}
//关闭流
is.close();

@ -15,7 +15,9 @@ import java.util.List;
public class TestSingle {
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
String sourceWord="D:\\dsWork\\YunNanDsBase\\Doc\\全省及州市县区人口与教育报告集20241023\\16个州市报告2022\\分析报告20240510\\西双版纳州人口变化及其对教育的影响20240420.docx";
//String sourceWord = "c:/保山市人口变化及其对教育的影响20240507.docx";
String sourceWord = "c:/西双版纳州人口变化及其对教育的影响20240420.docx";
//String sourceWord="c:/2.docx";
InputStream is = new FileInputStream(sourceWord);
ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is);
@ -29,9 +31,10 @@ public class TestSingle {
for (int i = 0; i < chartList.size(); i++) {
XWPFChart chart = chartList.get(i);
XSSFWorkbook workbook = chart.getWorkbook();
System.out.println(workbook.getNumberOfSheets());
XSSFSheet sheet = workbook.getSheetAt(0);
System.out.println("序号=" + (i + 1) + ",sheet名称=" + sheet.getSheetName());
if (sheet.getSheetName().equals("Sheet0")) {
if (sheet.getPhysicalNumberOfRows() == 0) {
System.out.println("===第" + (i + 1) + "个图表需要人工编辑一下Sheet名称否则无法读取===");
System.exit(0);
}

Loading…
Cancel
Save