01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17: package org.apache.poi.hslf.examples;
18:
19: import org.apache.poi.hslf.usermodel.SlideShow;
20: import org.apache.poi.hslf.usermodel.RichTextRun;
21: import org.apache.poi.hslf.model.Slide;
22: import org.apache.poi.hslf.model.TextBox;
23:
24: import java.io.FileOutputStream;
25:
26: /**
27: * How to create a single-level bulleted list
28: * and change some of the bullet attributes
29: *
30: * @author Yegor Kozlov
31: */
32: public class BulletsDemo {
33:
34: public static void main(String[] args) throws Exception {
35:
36: SlideShow ppt = new SlideShow();
37:
38: Slide slide = ppt.createSlide();
39:
40: TextBox shape = new TextBox();
41: RichTextRun rt = shape.getTextRun().getRichTextRuns()[0];
42: shape.setText("January\r" + "February\r" + "March\r" + "April");
43: rt.setFontSize(42);
44: rt.setBullet(true);
45: rt.setBulletOffset(0); //bullet offset
46: rt.setTextOffset(50); //text offset (should be greater than bullet offset)
47: rt.setBulletChar('\u263A'); //bullet character
48: slide.addShape(shape);
49:
50: shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300)); //position of the text box in the slide
51: slide.addShape(shape);
52:
53: FileOutputStream out = new FileOutputStream("bullets.ppt");
54: ppt.write(out);
55: out.close();
56: }
57: }
|