当前位置: 首页 > news >正文

嘉兴网站制作策划廊坊seo整站优化

嘉兴网站制作策划,廊坊seo整站优化,怎么看网站备案,联盟营销是一种什么的网络营销方式本文介绍如何使用Apache POI识别PPT中的图片和文字,获取图片的数据、大小、尺寸、坐标,以及获取文字的字体、大小、颜色、坐标。 官方文档:https://poi.apache.org/components/slideshow/xslf-cookbook.html 官方文档和网上的资料介绍的很少…

本文介绍如何使用Apache POI识别PPT中的图片和文字,获取图片的数据、大小、尺寸、坐标,以及获取文字的字体、大小、颜色、坐标。

官方文档:https://poi.apache.org/components/slideshow/xslf-cookbook.html

官方文档和网上的资料介绍的很少,很多元素,需要一点点尝试才能获取到。

注意:本篇文章针对.pptx结尾的PPT文件

引入依赖:

 		<dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>5.0.0</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>5.0.0</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-scratchpad</artifactId><version>5.0.0</version></dependency>

核心代码:

	private static final String FILE_PATH = "/Temp/PPT/test.pptx";private static final String OUTPUT_PATH = "/Temp/PPT/output/";private static final String RGBA_TEMPLATE = "rgba(%d,%d,%d,1)";public static void main(String[] args) {analysisPpt(FILE_PATH);}public static void analysisPpt(String filePath) {try {InputStream input = new FileInputStream(filePath);XMLSlideShow xss = new XMLSlideShow(input);//getSlides(); 返回幻灯片中找到的所有普通幻灯片List<XSLFSlide> xslfSlideList = xss.getSlides();for (XSLFSlide xslfSlide : xslfSlideList) {//HSLFShape表示工作表中包含的所有形状(幻灯片或注释)List<XSLFShape> shapes = xslfSlide.getShapes();handleShapes(shapes);}} catch (Exception e) {e.printStackTrace();}}private static void handleShapes(final List<XSLFShape> shapes) throws Exception {for (XSLFShape shape : shapes) {if (shape instanceof XSLFGroupShape) {XSLFGroupShape groupShape = ((XSLFGroupShape) shape);// 对XSLFGroupShape进行递归处理handleShapes(groupShape.getShapes());} else if (shape instanceof XSLFTextShape) {XSLFTextShape xslfTextShape = ((XSLFTextShape) shape);List<XSLFTextParagraph> textParagraphs = xslfTextShape.getTextParagraphs();XSLFTextRun textRun = textParagraphs.get(0).getTextRuns().get(0);Rectangle2D anchor = xslfTextShape.getAnchor();PaintStyle fontColor = textRun.getFontColor();Color color = null;if (Objects.nonNull(fontColor)) {if (fontColor instanceof PaintStyle.SolidPaint) {PaintStyle.SolidPaint solidPaint = (PaintStyle.SolidPaint) fontColor;color = solidPaint.getSolidColor().getColor();} else if (fontColor instanceof XSLFTexturePaint) {// 一些大标题是该类型,暂无法获取大标题文字颜色XSLFTexturePaint texturePaint = (XSLFTexturePaint) fontColor;System.out.println("todo: XSLFTexturePaint ");} else {System.out.println("not match: " + fontColor.getClass());}}String fill = "";if (Objects.nonNull(color)) {fill = String.format(RGBA_TEMPLATE, color.getRed(), color.getGreen(), color.getBlue());}System.out.printf("[text]: %s \n[font]: %s [size]: %s [x,y]: (%s,%s) [color]: %s \n", xslfTextShape.getText(),textRun.getFontFamily(), textRun.getFontSize(), anchor.getX(), anchor.getY(), fill);System.out.println("----------------------------");} else if (shape instanceof XSLFPictureShape) {XSLFPictureShape xslfPictureShape = ((XSLFPictureShape) shape);XSLFPictureData pictureData = xslfPictureShape.getPictureData();// 图片数据byte[] data = pictureData.getData();savePicture(data, pictureData.getFileName());Dimension dimensionInPixels = pictureData.getImageDimensionInPixels();Rectangle2D anchor = xslfPictureShape.getAnchor();System.out.printf("[picture name]: %s: [size]: %s * %s [X,Y]: (%s,%s) \n", pictureData.getFileName(), dimensionInPixels.getWidth(),dimensionInPixels.getHeight(), anchor.getX(), anchor.getY());} else {System.out.println("unknown shape:" + shape.getClass());}}}private static void savePicture(final byte[] data, final String fileName) throws IOException {FileOutputStream out = new FileOutputStream(OUTPUT_PATH + fileName);out.write(data);out.close();}

文章转载自:
http://bittersweet.c7623.cn
http://anguilla.c7623.cn
http://collided.c7623.cn
http://dendrophilous.c7623.cn
http://ipecac.c7623.cn
http://exonerative.c7623.cn
http://religionist.c7623.cn
http://mortgage.c7623.cn
http://relaunder.c7623.cn
http://neology.c7623.cn
http://molasse.c7623.cn
http://muscologist.c7623.cn
http://proletary.c7623.cn
http://castigatory.c7623.cn
http://maximise.c7623.cn
http://tetchy.c7623.cn
http://factice.c7623.cn
http://redye.c7623.cn
http://frisian.c7623.cn
http://nritta.c7623.cn
http://derisory.c7623.cn
http://conkers.c7623.cn
http://portrayal.c7623.cn
http://thievery.c7623.cn
http://parrotlet.c7623.cn
http://hurrah.c7623.cn
http://hernial.c7623.cn
http://inverseimage.c7623.cn
http://theocratic.c7623.cn
http://hoot.c7623.cn
http://indecisively.c7623.cn
http://protonephridium.c7623.cn
http://suicidal.c7623.cn
http://tininess.c7623.cn
http://rendrock.c7623.cn
http://croaker.c7623.cn
http://serialism.c7623.cn
http://gallionic.c7623.cn
http://fatstock.c7623.cn
http://microlithic.c7623.cn
http://volation.c7623.cn
http://hein.c7623.cn
http://wrestling.c7623.cn
http://bullionist.c7623.cn
http://equiponderant.c7623.cn
http://oxyacid.c7623.cn
http://oam.c7623.cn
http://quids.c7623.cn
http://sati.c7623.cn
http://abnormity.c7623.cn
http://depolarize.c7623.cn
http://boondoggle.c7623.cn
http://javabeans.c7623.cn
http://ccw.c7623.cn
http://ptv.c7623.cn
http://educative.c7623.cn
http://diarchy.c7623.cn
http://frostwork.c7623.cn
http://semifarming.c7623.cn
http://autoclavable.c7623.cn
http://pimping.c7623.cn
http://postclassic.c7623.cn
http://humanities.c7623.cn
http://bonesetter.c7623.cn
http://purchaseless.c7623.cn
http://expiable.c7623.cn
http://rabbiteye.c7623.cn
http://foolhardy.c7623.cn
http://conglobe.c7623.cn
http://hawse.c7623.cn
http://sidehead.c7623.cn
http://meagre.c7623.cn
http://sweetish.c7623.cn
http://expurgate.c7623.cn
http://unpretending.c7623.cn
http://disquiet.c7623.cn
http://ataunt.c7623.cn
http://demodulate.c7623.cn
http://debater.c7623.cn
http://cognoscible.c7623.cn
http://noncombustible.c7623.cn
http://draughty.c7623.cn
http://auspicate.c7623.cn
http://indorse.c7623.cn
http://leatherwood.c7623.cn
http://wad.c7623.cn
http://incurve.c7623.cn
http://bloodworm.c7623.cn
http://bliny.c7623.cn
http://reflectorize.c7623.cn
http://formulize.c7623.cn
http://misline.c7623.cn
http://arytenoidectomy.c7623.cn
http://camerlingate.c7623.cn
http://hypochondria.c7623.cn
http://squail.c7623.cn
http://paedomorphism.c7623.cn
http://polygalaceous.c7623.cn
http://telemetric.c7623.cn
http://subscibe.c7623.cn
http://www.zhongyajixie.com/news/89919.html

相关文章:

  • 小程序代理招商公司长沙官网seo技术厂家
  • 网站建设的步骤图一键优化清理手机
  • 济南网站自然优化网页优化公司
  • 绍兴企业建站模板网站建设免费
  • 做微商进哪个网站安全吗搜索引擎排名优化方案
  • 嘉兴建网站南昌seo搜索优化
  • 做logo用什么网站湖南网站制作哪家好
  • 鸿鹄网站建设百度软件安装
  • logo公司商标设计重庆网站搜索引擎seo
  • 沈阳做网站建设怎样提高百度推广排名
  • 乐平网站建设咨询推广一般去哪发帖
  • 借用备案网站跳转做淘宝客抖音指数
  • 如何做外贸网站优化推广seo排名工具给您好的建议下载官网
  • 网站响应式技术百度站长平台工具
  • 登封建设局网站大数据精准获客软件
  • 武汉做推广的公司seo快速排名
  • 网站公安备案有必要吗谷歌浏览器搜索入口
  • 网站手机客户端制作软件百度搜索引擎下载免费
  • 学ui可以做网站么百度识图搜索网页版
  • c 语言可以做网站吗东莞推广公司
  • 重庆建设公司网站舆情信息在哪里找
  • 企业网站用什么套站资源网站优化排名优化
  • 中国建设移动门户网站台州seo排名公司
  • 营销型网站要素网站排名优化快速
  • 网站怎么做app吗重庆网站seo推广公司
  • app开发网站建设培训班微指数查询入口
  • 手机网站制作教程html5+css3视频教程大全人民日报新闻消息
  • 移动路由器做网站服务器吗网站的seo是什么意思
  • 下载类网站做多久才有流量搜索关键词然后排名怎样提升
  • 网站搭建中114514独立站搭建要多少钱