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;
|
||||
|
||||
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.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 org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class Test1 {
|
||||
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);
|
||||
|
||||
// 获取文档中的第一个图表
|
||||
List<XWPFChart> shapes = document.getCharts();
|
||||
|
||||
|
||||
for (XWPFParagraph para : document.getParagraphs()) {
|
||||
|
||||
for (int i = 0; i < shapes.size(); i++) {
|
||||
|
||||
XSSFWorkbook workbook = shapes.get(i).getWorkbook();
|
||||
XSSFSheet sheet = workbook.getSheet(workbook.getSheetName(0));
|
||||
if(i==21)
|
||||
{
|
||||
System.out.println(11111);
|
||||
if(para.getText().indexOf("人口变化及趋势预测")!=-1){
|
||||
System.out.println(para.getText());
|
||||
}
|
||||
|
||||
XSSFRow row = sheet.getRow(0);
|
||||
System.out.println(row);
|
||||
System.out.println(row.getCell(0));
|
||||
System.out.println(i);
|
||||
// 获取段落的大纲级别
|
||||
// int outlineLevel = para.getInde .getIndentation().getIndentLevel();
|
||||
// if (outlineLevel > 0) {
|
||||
// System.out.println("大纲级别: " + outlineLevel + ", 内容: " + para.getText());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fis.close();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue