ASF Bugzilla – Attachment 22586 Details for
Bug 45815
[PATCH] Fix for extra bullets and bold on text boxes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Simple java test case that reads in a ppt file and writes it out unchanged
ReadWrite.java (text/plain), 2.23 KB, created by
Don Boulia
on 2008-09-15 18:18:44 UTC
(
hide
)
Description:
Simple java test case that reads in a ppt file and writes it out unchanged
Filename:
MIME Type:
Creator:
Don Boulia
Created:
2008-09-15 18:18:44 UTC
Size:
2.23 KB
patch
obsolete
>package pptMaker; > >import java.io.File; >import java.io.FileOutputStream; >import java.io.IOException; >import org.apache.poi.hslf.HSLFSlideShow; >import org.apache.poi.hslf.usermodel.SlideShow; >import org.apache.poi.hslf.model.*; > >/** > * Test file to take an input file, read it in as a ppt file, then write it back out > * Useful for seeing changes that occur as the file is processed by hslf > */ > >public class ReadWrite { > > public static final String _inputPPTFile = "/Users/djboulia/Downloads/testcase2in.ppt"; > public static final String _outputPPTFile = "/Users/djboulia/Downloads/testcase2out.ppt"; > > /** > * @param args > */ > public static void main(String[] args) throws IOException { > SlideShow ppt = new SlideShow(new HSLFSlideShow(_inputPPTFile)); > > //get slides > Slide[] slide = ppt.getSlides(); > for (int i = 0; i < slide.length; i++){ > System.out.println( "Slide " + i); > > Shape[] sh = slide[i].getShapes(); > for (int j = 0; j < sh.length; j++){ > //name of the shape > String name = sh[j].getShapeName(); > > //shapes's anchor which defines the position of this shape in the slide > java.awt.Rectangle anchor = sh[j].getAnchor(); > > if (sh[j] instanceof Line){ > Line line = (Line)sh[j]; > //work with Line > System.out.println( "Found a Line!"); > } else if (sh[j] instanceof AutoShape){ > AutoShape shape = (AutoShape)sh[j]; > //work with AutoShape > System.out.println( "Found an AutoShape!"); > } else if (sh[j] instanceof TextBox){ > TextBox shape = (TextBox)sh[j]; > //work with TextBox > String str = shape.getText(); > > System.out.println( "Found a TextBox!"); > System.out.println( str ); > > } else if (sh[j] instanceof Picture){ > Picture shape = (Picture)sh[j]; > //work with Picture > System.out.println( "Found a Picture!"); > > } else { > System.out.println("Found unknown shape: "+name); > } > } > } > > //save changes in a new file > FileOutputStream out = new FileOutputStream(_outputPPTFile); > ppt.write(out); > out.close(); > > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 45815
:
22584
|
22585
| 22586