poi操作ppt添加超链接
来源:互联网 发布:知图科技ceo 编辑:程序博客网 时间:2024/05/01 15:50
POI版本3.14。
创建超链接跳转到一个url,添加一个超链接跳转到另一个ppt页面。
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.==================================================================== */package org.apache.poi.hslf.examples;import java.awt.Rectangle;import java.io.FileOutputStream;import java.io.IOException;import org.apache.poi.hslf.usermodel.HSLFHyperlink;import org.apache.poi.hslf.usermodel.HSLFSlide;import org.apache.poi.hslf.usermodel.HSLFSlideShow;import org.apache.poi.hslf.usermodel.HSLFTextBox;/** * Demonstrates how to create hyperlinks in PowerPoint presentations */public abstract class CreateHyperlink { public static void main(String[] args) throws IOException { //创建ppt对象 HSLFSlideShow ppt = new HSLFSlideShow(); //构造页面 HSLFSlide slideA = ppt.createSlide(); //加第二个页面 HSLFSlide slideB = ppt.createSlide(); //第三页ppt HSLFSlide slideC = ppt.createSlide(); //第一个页面加一个文本框 HSLFTextBox textBox1 = slideA.createTextBox(); //文本框设置文字 textBox1.setText("Apache POI"); //设置位置和大小 textBox1.setAnchor(new Rectangle(100, 100, 200, 50)); //在文本框的文字上添加超链接 HSLFHyperlink link1 = textBox1.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink(); //设置连接URL link1.linkToUrl("http://www.apache.org"); //设置鼠标悬浮的文字 link1.setLabel(textBox1.getText()); //又添加一个文本框 HSLFTextBox textBox2 = slideA.createTextBox(); textBox2.setText("Go to slide #3"); textBox2.setAnchor(new Rectangle(100, 300, 200, 50)); //添加超链 HSLFHyperlink link2 = textBox2.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink(); //超链到第三个ppt页面 link2.linkToSlide(slideC); HSLFTextBox textBox3 = slideC.createTextBox(); textBox3.setText("third page"); textBox3.setAnchor(new Rectangle(200, 200, 200, 200)); FileOutputStream out = new FileOutputStream("hyperlink.ppt"); ppt.write(out); out.close(); ppt.close(); }}
0 0
- poi操作ppt添加超链接
- poi操作ppt添加带编号的文本框
- POI操作PPT
- poi 操作excel 生成超链接
- POI-----POI操作Excel-6、超链接
- 使用POI操作PPT文档
- java poi ppt操作示例
- poi操作PPT文档总结
- 使用POI操作PPT实例
- Java 利用POI操作PPT
- poi操作ppt创建表格
- poi操作ppt生成图表
- poi操作ppt生成文本框
- POI操作Excel---给单元格添加超链接(HSSF & XSSF & SXSSF)
- POI 超链接
- POI操作ppt报错:Blank layout was not found
- POI操作PPT之BUG处理-----不定期更新
- poi操作ppt图表史上最完整示例演示
- ubuntu 16.04 安装 openjdk 1.7
- 【Unity3D】ShaderLab实战
- Slidingmenu+Fragment中,按下home键返回桌面,再重新进入程序时报错问题的解决方法
- JAVA语言为什么能跨平台?
- 淘宝网商品SKU系统设计经验分享
- poi操作ppt添加超链接
- 解密:IT运维艺术之集群(4层AND7层)
- JS获取request域的值,JSP页面可以采取以下方式
- css样式标签和js语法属性区别
- Android 中 startService()启动service的过程分析
- Android SlidingMenu 使用详解
- LDA(Latent Dirichlet Allocation)主题模型算法
- mysql更新数据
- 生活记录