本文整理汇总了Java中org.apache.poi.hslf.usermodel.SlideShow类的典型用法代码示例。如果您正苦于以下问题:Java SlideShow类的具体用法?Java SlideShow怎么用?Java SlideShow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SlideShow类属于org.apache.poi.hslf.usermodel包,在下文中一共展示了SlideShow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithslides/addbackground/data/";
SlideShow ppt = new SlideShow();
//add first slide
Slide s1 = ppt.createSlide();
SlideMaster master = ppt.getSlidesMasters()[0];
Fill fill = master.getBackground().getFill();
int idx = ppt.addPicture(new File(dataPath + "background.jpg"), Picture.JPEG);
fill.setFillType(Fill.FILL_PICTURE);
fill.setPictureData(idx);
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "AddBG_Apache_Out.ppt");
ppt.write(out);
out.close();
System.out.println("Background Added.");
}
示例2: main
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithslides/setslidetitle/data/";
SlideShow ppt = new SlideShow();
Slide slide = ppt.createSlide();
TextBox title = slide.addTitle();
title.setText("Hello, World!");
//save changes
FileOutputStream out = new FileOutputStream(dataPath + "Apache_SlideTitle_Out.ppt");
ppt.write(out);
out.close();
System.out.println("Presentation with Title Saved.");
}
示例3: main
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithpresentation/addslides/data/";
//create a new empty slide show
SlideShow ppt = new SlideShow();
//add first slide
Slide s1 = ppt.createSlide();
//add second slide
Slide s2 = ppt.createSlide();
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "AddSlides_Apache_Out.ppt");
ppt.write(out);
out.close();
System.out.println("Slide Added and Saved.");
}
示例4: main
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithpresentation/createheaderfooter/data/";
SlideShow ppt = new SlideShow();
ppt.createSlide();
//presentation-scope headers / footers
HeadersFooters hf = ppt.getSlideHeadersFooters();
hf.setSlideNumberVisible(true);
hf.setFootersText("Created by POI-HSLF");
FileOutputStream out = new FileOutputStream(dataPath + "ApacheHeaderFooter.ppt");
ppt.write(out);
out.close();
System.out.println("Done...");
}
示例5: main
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithpresentation/createnewpresentation/data/";
//create a new empty slide show
SlideShow ppt = new SlideShow();
//add first slide
Slide s1 = ppt.createSlide();
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "NewPPT_Apache_Out.ppt");
ppt.write(out);
out.close();
//Printing the status
System.out.println("Presentation Created successfully!");
}
示例6: getPictureData
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* Returns the picture data for this picture.
*
* @return the picture data for this picture.
*/
public PictureData getPictureData(){
SlideShow ppt = getSheet().getSlideShow();
PictureData[] pict = ppt.getPictureData();
EscherBSERecord bse = getEscherBSERecord();
if (bse == null){
logger.log(POILogger.ERROR, "no reference to picture data found ");
} else {
for ( int i = 0; i < pict.length; i++ ) {
if (pict[i].getOffset() == bse.getOffset()){
return pict[i];
}
}
logger.log(POILogger.ERROR, "no picture found for our BSE offset " + bse.getOffset());
}
return null;
}
示例7: getEscherBSERecord
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
protected EscherBSERecord getEscherBSERecord(){
SlideShow ppt = getSheet().getSlideShow();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
if(bstore == null) {
logger.log(POILogger.DEBUG, "EscherContainerRecord.BSTORE_CONTAINER was not found ");
return null;
}
List lst = bstore.getChildRecords();
int idx = getPictureIndex();
if (idx == 0){
logger.log(POILogger.DEBUG, "picture index was not found, returning ");
return null;
}
return (EscherBSERecord)lst.get(idx-1);
}
示例8: getEscherBSERecord
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
protected EscherBSERecord getEscherBSERecord(int idx){
Sheet sheet = shape.getSheet();
if(sheet == null) {
logger.log(POILogger.DEBUG, "Fill has not yet been assigned to a sheet");
return null;
}
SlideShow ppt = sheet.getSlideShow();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
if(bstore == null) {
logger.log(POILogger.DEBUG, "EscherContainerRecord.BSTORE_CONTAINER was not found ");
return null;
}
List lst = bstore.getChildRecords();
return (EscherBSERecord)lst.get(idx-1);
}
示例9: find
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* Find hyperlinks in a text run
*
* @param run <code>TextRun</code> to lookup hyperlinks in
* @return found hyperlinks or <code>null</code> if not found
*/
protected static Hyperlink[] find(TextRun run){
ArrayList lst = new ArrayList();
SlideShow ppt = run.getSheet().getSlideShow();
//document-level container which stores info about all links in a presentation
ExObjList exobj = ppt.getDocumentRecord().getExObjList();
if (exobj == null) {
return null;
}
Record[] records = run._records;
if(records != null) find(records, exobj, lst);
Hyperlink[] links = null;
if (lst.size() > 0){
links = new Hyperlink[lst.size()];
lst.toArray(links);
}
return links;
}
示例10: getObjectData
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* Returns unique identifier for the OLE object.
*
* @return the unique identifier for the OLE object
*/
public ObjectData getObjectData(){
SlideShow ppt = getSheet().getSlideShow();
ObjectData[] ole = ppt.getEmbeddedObjects();
//persist reference
ExEmbed exEmbed = getExEmbed();
ObjectData data = null;
if(exEmbed != null) {
int ref = exEmbed.getExOleObjAtom().getObjStgDataRef();
for (int i = 0; i < ole.length; i++) {
if(ole[i].getExOleObjStg().getPersistId() == ref) {
data=ole[i];
}
}
}
if (data==null) {
logger.log(POILogger.WARN, "OLE data not found");
}
return data;
}
示例11: getExEmbed
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* Return the record container for this embedded object.
*
* <p>
* It contains:
* 1. ExEmbedAtom.(4045)
* 2. ExOleObjAtom (4035)
* 3. CString (4026), Instance MenuName (1) used for menus and the Links dialog box.
* 4. CString (4026), Instance ProgID (2) that stores the OLE Programmatic Identifier.
* A ProgID is a string that uniquely identifies a given object.
* 5. CString (4026), Instance ClipboardName (3) that appears in the paste special dialog.
* 6. MetaFile( 4033), optional
* </p>
*/
public ExEmbed getExEmbed(){
if(_exEmbed == null){
SlideShow ppt = getSheet().getSlideShow();
ExObjList lst = ppt.getDocumentRecord().getExObjList();
if(lst == null){
logger.log(POILogger.WARN, "ExObjList not found");
return null;
}
int id = getObjectID();
Record[] ch = lst.getChildRecords();
for (int i = 0; i < ch.length; i++) {
if(ch[i] instanceof ExEmbed){
ExEmbed embd = (ExEmbed)ch[i];
if( embd.getExOleObjAtom().getObjID() == id) _exEmbed = embd;
}
}
}
return _exEmbed;
}
示例12: setSlideShow
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* Assign SlideShow for this slide master.
* (Used interanlly)
*/
public void setSlideShow(SlideShow ss) {
super.setSlideShow(ss);
//after the slide show is assigned collect all available style records
if (_txmaster == null) {
_txmaster = new TxMasterStyleAtom[9];
TxMasterStyleAtom txdoc = getSlideShow().getDocumentRecord().getEnvironment().getTxMasterStyleAtom();
_txmaster[txdoc.getTextType()] = txdoc;
TxMasterStyleAtom[] txrec = ((MainMaster)getSheetContainer()).getTxMasterStyleAtoms();
for (int i = 0; i < txrec.length; i++) {
int txType = txrec[i].getTextType();
if(_txmaster[txType] == null) _txmaster[txType] = txrec[i];
}
}
}
示例13: getPath
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
/**
* @return UNC or local path to a video file
*/
public String getPath(){
OEShapeAtom oe = (OEShapeAtom)getClientDataRecord(RecordTypes.OEShapeAtom.typeID);
int idx = oe.getOptions();
SlideShow ppt = getSheet().getSlideShow();
ExObjList lst = (ExObjList)ppt.getDocumentRecord().findFirstOfType(RecordTypes.ExObjList.typeID);
if(lst == null) return null;
Record[] r = lst.getChildRecords();
for (int i = 0; i < r.length; i++) {
if(r[i] instanceof ExMCIMovie){
ExMCIMovie mci = (ExMCIMovie)r[i];
ExVideoContainer exVideo = mci.getExVideo();
int objectId = exVideo.getExMediaAtom().getObjectId();
if(objectId == idx){
return exVideo.getPathAtom().getText();
}
}
}
return null;
}
示例14: exportAsImages
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
private static void exportAsImages(final SlideShow ppt, final File... files) throws IOException {
if (log.isTraceEnabled()) log.trace(HelperLog.methodStart(ppt, files));
final Dimension size = ppt.getPageSize();
final Slide[] slides = ppt.getSlides();
for (int ii = 0; ii < slides.length; ii++) {
final BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
final Graphics2D g2d = image.createGraphics();
// clear the drawing area
g2d.setPaint(Color.WHITE);
g2d.fill(new Rectangle2D.Float(0, 0, size.width, size.height));
// render
slides[ii].draw(g2d);
HelperImage.writeImage(files[ii], IMAGE_TYPE, image);
}
if (log.isTraceEnabled()) log.trace(HelperLog.methodExit());
}
示例15: handleSlideEmbeddedPictures
import org.apache.poi.hslf.usermodel.SlideShow; //导入依赖的package包/类
private void handleSlideEmbeddedPictures(SlideShow slideshow,
XHTMLContentHandler xhtml) throws TikaException, SAXException,
IOException {
for (PictureData pic : slideshow.getPictureData()) {
String mediaType = null;
switch (pic.getType()) {
case Picture.EMF:
mediaType = "application/x-emf";
break;
case Picture.JPEG:
mediaType = "image/jpeg";
break;
case Picture.PNG:
mediaType = "image/png";
break;
case Picture.WMF:
mediaType = "application/x-msmetafile";
break;
case Picture.DIB:
mediaType = "image/bmp";
break;
}
try {
handleEmbeddedResource(TikaInputStream.get(pic.getData()), null, null,
mediaType, xhtml, false);
} catch (Exception e) {
// log as info
}
}
}