parent
9cf764a2c5
commit
ec1753f56e
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,56 @@
|
|||||||
|
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 java.io.FileInputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Test1 {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
FileInputStream fis = new FileInputStream("c:\\b.docx");
|
||||||
|
XWPFDocument document = new XWPFDocument(fis);
|
||||||
|
|
||||||
|
// 获取文档中的第一个图表
|
||||||
|
List<XWPFChart> shapes = document.getCharts();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSSFRow row = sheet.getRow(0);
|
||||||
|
System.out.println(row);
|
||||||
|
System.out.println(row.getCell(0));
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue