gpt4 book ai didi

org.apache.poi.xslf.usermodel.XSLFSlideMaster.getLayout()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 09:05:05 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.poi.xslf.usermodel.XSLFSlideMaster.getLayout()方法的一些代码示例,展示了XSLFSlideMaster.getLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFSlideMaster.getLayout()方法的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFSlideMaster
类名称:XSLFSlideMaster
方法名:getLayout

XSLFSlideMaster.getLayout介绍

[英]Get the slide layout by name.
[中]按名称获取幻灯片布局。

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Scan the master slides for the first slide layout with the given name.
 *
 * @param name The layout name (case-insensitive). Cannot be null.
 * @return the first layout found or null on failure
 */
public XSLFSlideLayout findLayout(String name) {
  for (XSLFSlideMaster master : getSlideMasters()) {
    XSLFSlideLayout layout = master.getLayout(name);
    if (layout != null) {
      return layout;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Create a blank slide using the default (first) master.
 */
@Override
public XSLFSlide createSlide() {
  XSLFSlideMaster sm = _masters.get(0);
  XSLFSlideLayout layout = sm.getLayout(SlideLayout.BLANK);
  if (layout == null) {
    LOG.log(POILogger.WARN, "Blank layout was not found - defaulting to first slide layout in master");
    XSLFSlideLayout sl[] = sm.getSlideLayouts();
    if (sl.length == 0) {
      throw new POIXMLException("SlideMaster must contain a SlideLayout.");
    }
    layout = sl[0];
  }
  return createSlide(layout);
}

代码示例来源:origin: stackoverflow.com

XSLFSlideMaster defaultMaster = slideShow.getSlideMasters()[0];    
XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Scan the master slides for the first slide layout with the given name.
 *
 * @param name The layout name (case-insensitive). Cannot be null.
 * @return the first layout found or null on failure
 */
public XSLFSlideLayout findLayout(String name) {
  for (XSLFSlideMaster master : getSlideMasters()) {
    XSLFSlideLayout layout = master.getLayout(name);
    if (layout != null) {
      return layout;
    }
  }
  return null;
}

代码示例来源:origin: stackoverflow.com

XSLFSlideMaster defaultMaster = slideShow.getSlideMasters()[0];
   XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE_ONLY);
   newSlide = slideShow.createSlide(titleLayout);
   final List<CTShape> spList = slide.getXmlObject().getCSld().getSpTree().getSpList();
   for (CTShape ctShape : spList) {
     try {
       final STPlaceholderType.Enum type;
       type = ctShape.getNvSpPr().getNvPr().getPh().getType();
       if (type == STPlaceholderType.SLD_NUM) {
         final CTShape newSlideNumber = newSlide.getXmlObject().getCSld().getSpTree().addNewSp();
         newSlideNumber.set(ctShape);
         break;
       }
     } catch (NullPointerException e) {
       //Just ignore exception, this rather bad code style is used to avoid multiple checks
     }
   }

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Create a blank slide.
 */
public XSLFSlide createSlide() {
  String masterId = _presentation.getSldMasterIdLst().getSldMasterIdArray(0).getId2();
  XSLFSlideMaster master = _masters.get(masterId);
  XSLFSlideLayout layout = master.getLayout(SlideLayout.BLANK);
  if(layout == null) throw new IllegalArgumentException("Blank layout was not found");
  return createSlide(layout);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Create a blank slide using the default (first) master.
 */
@Override
public XSLFSlide createSlide() {
  XSLFSlideMaster sm = _masters.get(0);
  XSLFSlideLayout layout = sm.getLayout(SlideLayout.BLANK);
  if (layout == null) {
    LOG.log(POILogger.WARN, "Blank layout was not found - defaulting to first slide layout in master");
    XSLFSlideLayout sl[] = sm.getSlideLayouts();
    if (sl.length == 0) {
      throw new POIXMLException("SlideMaster must contain a SlideLayout.");
    }
    layout = sl[0];
  }
  return createSlide(layout);
}

代码示例来源:origin: stackoverflow.com

import org.apache.poi.xslf.usermodel.*;

import java.io.FileOutputStream;
import java.io.IOException;

public class Slideshow {
  public static void main(String[] args) throws IOException {
    //creating presentation
    try (FileOutputStream out = new FileOutputStream("example.ppt");
       XMLSlideShow ppt = new XMLSlideShow();) {
      //getting the slide master object
      XSLFSlideMaster slideMaster = ppt.getSlideMasters().get(0);

      //get the desired slide layout
      XSLFSlideLayout titleLayout = slideMaster.getLayout(SlideLayout.TITLE);

      //creating a slide with title layout
      XSLFSlide slide1 = ppt.createSlide(titleLayout);

      //selecting the place holder in it
      XSLFTextShape title1 = slide1.getPlaceholder(0);
      title1.setText("Text title");
      ppt.write(out);
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-examples

XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);
XSLFSlide slide1 = ppt.createSlide(titleLayout);
XSLFTextShape title1 = slide1.getPlaceholder(0);
XSLFSlideLayout titleBodyLayout = defaultMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);
XSLFSlide slide2 = ppt.createSlide(titleBodyLayout);

代码示例来源:origin: org.apache.poi/poi-examples

XSLFSlideLayout layout1 = master.getLayout(SlideLayout.TITLE);
XSLFSlide slide1 = ppt.createSlide(layout1);
XSLFTextShape[] ph1 = slide1.getPlaceholders();
subtitlePlaceholder1.setText("this is a subtitle");
XSLFSlideLayout layout2 = master.getLayout(SlideLayout.TITLE_AND_CONTENT);
XSLFSlide slide2 = ppt.createSlide(layout2);
XSLFTextShape[] ph2 = slide2.getPlaceholders();

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com