0
私は両方のOLE2とOpenXMLの仕様のためのサンプルがあるはずApache POI XSLFに行くが、唯一のOLE2ベース恐ろしいスライドレイアウトのフォーマット例がある場合。Apache PoiとXSLFを使ってOpenXML形式でPowePointプレゼンテーションを作成する方法は?
誰もがXMLのスライドのレイアウトフォーマットの例で私を助けてくださいもらえますか? APIは全く異なっています。
これは、1つだけでXSSFWorkbookにHSSFWorkbookの実装を変更spreadsheetにようにされていません。
これはどのようにXSLFの実装と同じように見えるのでしょうか? POIは最初からドキュメントを作成することはできませんので、既存の空のダミードキュメントが必要です。
//table data
String[][] data = {
{"INPUT FILE", "NUMBER OF RECORDS"},
{"Item File", "11,559"},
{"Vendor File", "300"},
{"Purchase History File", "10,000"},
{"Total # of requisitions", "10,200,038"}
};
SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
//create a table of 5 rows and 2 columns
Table table = new Table(5, 2);
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
TableCell cell = table.getCell(i, j);
cell.setText(data[i][j]);
RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
rt.setFontName("Arial");
rt.setFontSize(10);
cell.setVerticalAlignment(TextBox.AnchorMiddle);
cell.setHorizontalAlignment(TextBox.AlignCenter);
}
}
//set table borders
Line border = table.createBorder();
border.setLineColor(Color.black);
border.setLineWidth(1.0);
table.setAllBorders(border);
//set width of the 1st column
table.setColumnWidth(0, 300);
//set width of the 2nd column
table.setColumnWidth(1, 150);
slide.addShape(table);
table.moveTo(100, 100);
FileOutputStream out = new FileOutputStream(file);
ppt.write(out);
out.close();