b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

POI的PPT文本框生成和样式设置示例

电脑杂谈  发布时间:2020-06-28 01:20:23  来源:网络整理

ppt 文本框 样式_word2007怎么修改超链接文本样式_html搜索框样式

大哥去医院治疗了.

医生问: 您患有什么疾病?

html搜索框样式_word2007怎么修改超链接文本样式_ppt 文本框 样式

兄弟说: 我患有间接性失忆症.

医生问: 具体症状是什么?

word2007怎么修改超链接文本样式_html搜索框样式_ppt 文本框 样式

兄弟说: 一见到美丽的姑娘ppt 文本样式,我就忘了我已经结婚了.

医生说: 翻滚,我本人还没有治愈!

word2007怎么修改超链接文本样式_ppt 文本框 样式_html搜索框样式

POI如何生成PPT文本框和样式? ? ? ?

直接举一个例子相对简单,但是要慢慢来ppt 文本框 样式,一步一步来……

html搜索框样式_ppt 文本框 样式_word2007怎么修改超链接文本样式

package com.hwy.test;   
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextBox;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.xslf.XSLFSlideShow;
import org.apache.poi.xslf.usermodel.*;
import java.awt.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
/**
 * PPT简单导出
 * Created by Ay on 2016/6/14.
 */
public class MyFirstPPTTest {
    public static void main(String[] args) throws Exception{
        String filePath = "D://MyPPT.pptx";
        /** 加载PPT **/
        XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(filePath));
        /** 创建一个slide,理解为PPT里的每一页 **/
        XSLFSlide xslfSlide = ppt.createSlide();
        /** 创建一个文本框 **/
        XSLFTextBox xslfTextBox = xslfSlide.createTextBox();
        XSLFTextBox xslfTextBox2 = xslfSlide.createTextBox();
        XSLFTextBox xslfTextBox3 = xslfSlide.createTextBox();
        /** 生成一个新的文本段落 **/
        XSLFTextParagraph paragraph = xslfTextBox.addNewTextParagraph();
        XSLFTextParagraph paragraph2 = xslfTextBox.addNewTextParagraph();
        XSLFTextParagraph paragraph3 = xslfTextBox.addNewTextParagraph();
        /** 添加新的文本 **/
        XSLFTextRun xslfTextRun = paragraph.addNewTextRun();
        XSLFTextRun xslfTextRun2 = paragraph2.addNewTextRun();
        XSLFTextRun xslfTextRun3 = paragraph3.addNewTextRun();
        /** 设置内容 **/
        xslfTextRun.setText("标题一");
        xslfTextRun2.setText("标题二");
        xslfTextRun3.setText("标题三");
        /** 设置加粗 **/
        xslfTextRun.setBold(true);
        xslfTextRun2.setBold(true);
        xslfTextRun3.setBold(true);
        /** 设置颜色 **/
        xslfTextRun.setFontColor(new Color(32, 33, 101));
        xslfTextRun2.setFontColor(new Color(32, 33, 101));
        xslfTextRun3.setFontColor(new Color(32, 33, 101));
        /** 设置字体大小 **/
        xslfTextRun.setFontSize(24);
        xslfTextRun2.setFontSize(24);
        xslfTextRun3.setFontSize(24);
        /** 设置字体 **/
        xslfTextRun.setFontFamily("仿宋_GB2312");
        xslfTextRun2.setFontFamily("仿宋_GB2312");
        xslfTextRun3.setFontFamily("仿宋_GB2312");
        /** 设置斜体 和 下划线 **/
        //xslfTextRun.setItalic(true);
        xslfTextRun.setUnderline(true);
        xslfTextRun2.setUnderline(true);
        xslfTextRun3.setUnderline(true);
        /** 4个参数分别为 x , y , width , height **/
        xslfTextBox.setAnchor(new Rectangle(20, 30, 100, 100));
        xslfTextBox2.setAnchor(new Rectangle(20, 60, 100, 100));
        xslfTextBox3.setAnchor(new Rectangle(20, 90, 100, 100));
        /** 输出文件 **/
        ppt.write(new FileOutputStream(filePath));
    }
}

插图

日本电影《只爱你》


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-260858-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...