apacheconeu08.java
来自「EXCEL read and write」· Java 代码 · 共 518 行 · 第 1/2 页
JAVA
518 行
" TextBox box2 = new TextBox();\r" +
" box2.setHorizontalAlignment(TextBox.AlignCenter);\r" +
" box2.setVerticalAlignment(TextBox.AnchorMiddle);\r" +
" box2.getTextRun().setText(\"Java Code\");\r" +
" box2.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box2.setLineColor(Color.black);\r" +
" box2.setLineWidth(0.75);\r" +
" box2.setAnchor(new Rectangle(66, 243, 170, 170));\r" +
" slide.addShape(box2);\r" +
"\r" +
" TextBox box3 = new TextBox();\r" +
" box3.setHorizontalAlignment(TextBox.AlignCenter);\r" +
" box3.setVerticalAlignment(TextBox.AnchorMiddle);\r" +
" box3.getTextRun().setText(\"*.ppt file\");\r" +
" box3.setLineWidth(0.75);\r" +
" box3.setLineColor(Color.black);\r" +
" box3.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box3.setAnchor(new Rectangle(473, 243, 170, 170));\r" +
" slide.addShape(box3);\r" +
"\r" +
" AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\r" +
" box4.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box4.setLineWidth(0.75);\r" +
" box4.setLineColor(Color.black);\r" +
" box4.setAnchor(new Rectangle(253, 288, 198, 85));\r" +
" slide.addShape(box4);\r" +
"\r" +
" FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +
" ppt.write(out);\r" +
" out.close();");
box3.setAnchor(new Rectangle(30, 150, 618, 411));
slide.addShape(box3);
}
public static void slide7(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
TextBox box2 = new TextBox();
box2.setHorizontalAlignment(TextBox.AlignCenter);
box2.setVerticalAlignment(TextBox.AnchorMiddle);
box2.getTextRun().setText("Java Code");
box2.getFill().setForegroundColor(new Color(187, 224, 227));
box2.setLineColor(Color.black);
box2.setLineWidth(0.75);
box2.setAnchor(new Rectangle(66, 243, 170, 170));
slide.addShape(box2);
TextBox box3 = new TextBox();
box3.setHorizontalAlignment(TextBox.AlignCenter);
box3.setVerticalAlignment(TextBox.AnchorMiddle);
box3.getTextRun().setText("*.ppt file");
box3.setLineWidth(0.75);
box3.setLineColor(Color.black);
box3.getFill().setForegroundColor(new Color(187, 224, 227));
box3.setAnchor(new Rectangle(473, 243, 170, 170));
slide.addShape(box3);
AutoShape box4 = new AutoShape(ShapeTypes.Arrow);
box4.getFill().setForegroundColor(new Color(187, 224, 227));
box4.setLineWidth(0.75);
box4.setLineColor(Color.black);
box4.setAnchor(new Rectangle(253, 288, 198, 85));
slide.addShape(box4);
}
public static void slide8(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("Wait, there is more!");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.setText(
"Rich text\r" +
"Tables\r" +
"Pictures (JPEG, PNG, BMP, WMF, PICT)\r" +
"Comprehensive formatting features");
box2.setAnchor(new Rectangle(36, 126, 648, 356));
slide.addShape(box2);
}
public static void slide9(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF in Action - 3");
box1.setAnchor(new Rectangle(36, 20, 648, 50));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.getRichTextRuns()[0].setFontSize(18);
tr2.setText("PPGraphics2D: PowerPoint Graphics2D driver");
box2.setAnchor(new Rectangle(178, 70, 387, 30));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
RichTextRun rt3 = tr3.getRichTextRuns()[0];
rt3.setFontName("Courier New");
rt3.setFontSize(8);
tr3.setText(
" //bar chart data. The first value is the bar color, the second is the width\r" +
" Object[] def = new Object[]{\r" +
" Color.yellow, new Integer(100),\r" +
" Color.green, new Integer(150),\r" +
" Color.gray, new Integer(75),\r" +
" Color.red, new Integer(200),\r" +
" };\r" +
"\r" +
" SlideShow ppt = new SlideShow();\r" +
" Slide slide = ppt.createSlide();\r" +
"\r" +
" ShapeGroup group = new ShapeGroup();\r" +
" //define position of the drawing in the slide\r" +
" Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\r" +
" group.setAnchor(bounds);\r" +
" slide.addShape(group);\r" +
" Graphics2D graphics = new PPGraphics2D(group);\r" +
"\r" +
" //draw a simple bar graph\r" +
" int x = bounds.x + 50, y = bounds.y + 50;\r" +
" graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\r" +
" for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\r" +
" graphics.setColor(Color.black);\r" +
" int width = ((Integer)def[i+1]).intValue();\r" +
" graphics.drawString(\"Q\" + idx, x-20, y+20);\r" +
" graphics.drawString(width + \"%\", x + width + 10, y + 20);\r" +
" graphics.setColor((Color)def[i]);\r" +
" graphics.fill(new Rectangle(x, y, width, 30));\r" +
" y += 40;\r" +
" }\r" +
" graphics.setColor(Color.black);\r" +
" graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\r" +
" graphics.draw(bounds);\r" +
" graphics.drawString(\"Performance\", x + 70, y + 40);\r" +
"\r" +
" FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +
" ppt.write(out);\r" +
" out.close();");
box3.setAnchor(new Rectangle(96, 110, 499, 378));
slide.addShape(box3);
}
public static void slide10(SlideShow ppt) throws IOException {
//bar chart data. The first value is the bar color, the second is the width
Object[] def = new Object[]{
Color.yellow, new Integer(100),
Color.green, new Integer(150),
Color.gray, new Integer(75),
Color.red, new Integer(200),
};
Slide slide = ppt.createSlide();
ShapeGroup group = new ShapeGroup();
//define position of the drawing in the slide
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
group.setAnchor(bounds);
slide.addShape(group);
Graphics2D graphics = new PPGraphics2D(group);
//draw a simple bar graph
int x = bounds.x + 50, y = bounds.y + 50;
graphics.setFont(new Font("Arial", Font.BOLD, 10));
for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {
graphics.setColor(Color.black);
int width = ((Integer)def[i+1]).intValue();
graphics.drawString("Q" + idx, x-20, y+20);
graphics.drawString(width + "%", x + width + 10, y + 20);
graphics.setColor((Color)def[i]);
graphics.fill(new Rectangle(x, y, width, 30));
y += 40;
}
graphics.setColor(Color.black);
graphics.setFont(new Font("Arial", Font.BOLD, 14));
graphics.draw(bounds);
graphics.drawString("Performance", x + 70, y + 40);
}
public static void slide11(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF Development Plans");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.getRichTextRuns()[0].setFontSize(32);
tr2.setText(
"Support for more PowerPoint functionality\r" +
"Rendering slides into java.awt.Graphics2D");
box2.setAnchor(new Rectangle(36, 126, 648, 100));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
tr3.setRunType(TextHeaderAtom.BODY_TYPE);
tr3.getRichTextRuns()[0].setIndentLevel(1);
tr3.setText(
"A way to export slides into images or other formats");
box3.setAnchor(new Rectangle(36, 220, 648, 70));
slide.addShape(box3);
TextBox box4 = new TextBox();
TextRun tr4 = box4.getTextRun();
tr4.setRunType(TextHeaderAtom.BODY_TYPE);
tr4.getRichTextRuns()[0].setFontSize(32);
tr4.setText(
"Integration with Apache FOP - Formatting Objects Processor");
box4.setAnchor(new Rectangle(36, 290, 648, 90));
slide.addShape(box4);
TextBox box5 = new TextBox();
TextRun tr5 = box5.getTextRun();
tr5.setRunType(TextHeaderAtom.BODY_TYPE);
tr5.getRichTextRuns()[0].setIndentLevel(1);
tr5.setText(
"Transformation of XSL-FO into PPT\r" +
"PPT2PDF transcoder");
box5.setAnchor(new Rectangle(36, 380, 648, 100));
slide.addShape(box5);
}
public static void slide12(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);
tr1.setText("Questions?");
box1.setAnchor(new Rectangle(54, 167, 612, 115));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);
tr2.setText(
"http://poi.apache.org/hslf/\r" +
"http://people.apache.org/~yegor");
box2.setAnchor(new Rectangle(108, 306, 504, 138));
slide.addShape(box2);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?