gpt4 book ai didi

apache-poi - 如何选择要在 Apache POI 中使用的自定义布局

转载 作者:行者123 更新时间:2023-12-01 23:49:49 28 4
gpt4 key购买 nike

我有一个带有以下幻灯片布局的 pptx:

System.out.println("Available slide layouts:");
for(XSLFSlideMaster master : ppt.getSlideMasters()){
for(XSLFSlideLayout layout : master.getSlideLayouts()){
System.out.println("Name: "+layout.getName()+" Type: "+layout.getType());

Available slide layouts:
Name: Content Type: OBJ_ONLY
Name: Title and 4 Content Type: FOUR_OBJ
Name: Title Only Type: TITLE_ONLY
Name: DETAIL_SCORECARD Type: CUST
Name: Scorecard Type: CUST
Name: CSCLayout1 Type: CUST
Name: 1_Blank Type: BLANK
Name: Title, Content, and 2 Content Type: OBJ_AND_TWO_OBJ
Name: Title and Content Type: TITLE_AND_CONTENT
Name: Title, Text, and Content Type: TX_AND_OBJ
Name: Two Content Type: TWO_OBJ
Name: Main Type: TITLE

如何选择第二个或第三个 CUST 布局选项

当前的实现适用于第一个 CUST 幻灯片布局

FileInputStream input = null;
input = new FileInputStream(filename);
slideshow = new XMLSlideShow(input);
XSLFSlideMaster defaultMaster = slideshow.getSlideMasters()[0];
XSLFSlideLayout detailedscorecard = defaultMaster.getLayout(SlideLayout.CUST);

我已经尝试在幻灯片母版中重命名幻灯片名称,但它似乎对上面的列表没有任何影响。有没有办法使用 layout.getName() 找到幻灯片布局的实际名称,

XSLFSlideLayout detailedscorecard = defaultMaster.getLayout(SlideLayout.CUST);

最佳答案

好的..得到 friend 的回答并解决了......

XSLFSlideLayout detailedscorecard = null;
for (XSLFSlideMaster master : slideshow.getSlideMasters()){
for (XSLFSlideLayout layout1 : master.getSlideLayouts()){
if (layout1.getName().equals("Scorecard")) {
detailedscorecard=layout1;
}
}
}

关于apache-poi - 如何选择要在 Apache POI 中使用的自定义布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27066425/

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