Merge branch 'main' of http://10.10.14.176:3000/huanghai/YunNanDsBase
commit
7697f17965
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,56 +1,31 @@
|
|||||||
package com.dsideal.base.Test;
|
package com.dsideal.base.Test;
|
||||||
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
|
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFChart;
|
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
|
|
||||||
|
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx;
|
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
|
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Test1 {
|
public class Test1 {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
FileInputStream fis = new FileInputStream("c:\\b.docx");
|
FileInputStream fis = new FileInputStream("c:\\a.docx");
|
||||||
XWPFDocument document = new XWPFDocument(fis);
|
XWPFDocument document = new XWPFDocument(fis);
|
||||||
|
|
||||||
// 获取文档中的第一个图表
|
for (XWPFParagraph para : document.getParagraphs()) {
|
||||||
List<XWPFChart> shapes = document.getCharts();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < shapes.size(); i++) {
|
|
||||||
|
|
||||||
XSSFWorkbook workbook = shapes.get(i).getWorkbook();
|
if(para.getText().indexOf("人口变化及趋势预测")!=-1){
|
||||||
XSSFSheet sheet = workbook.getSheet(workbook.getSheetName(0));
|
System.out.println(para.getText());
|
||||||
if(i==21)
|
|
||||||
{
|
|
||||||
System.out.println(11111);
|
|
||||||
}
|
}
|
||||||
|
// 获取段落的大纲级别
|
||||||
XSSFRow row = sheet.getRow(0);
|
// int outlineLevel = para.getInde .getIndentation().getIndentLevel();
|
||||||
System.out.println(row);
|
// if (outlineLevel > 0) {
|
||||||
System.out.println(row.getCell(0));
|
// System.out.println("大纲级别: " + outlineLevel + ", 内容: " + para.getText());
|
||||||
System.out.println(i);
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fis.close();
|
fis.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue