当前位置:首页>python>HyperView Python 二次开发 自动导出PPT报告

HyperView Python 二次开发 自动导出PPT报告

  • 2026-09-24 19:27:41
HyperView Python 二次开发 自动导出PPT报告

HyperView基于Tcl语言导出PPT方法:

Hyperview二次开发之自动截图和导出PPT报告

HyperView基于Python语言导出PPT方法:

import hwimport hmimport os#=====================# 使用HWC窗口录制命令,一条命令导出所有窗口#=====================ses = hw.Session()win=ses.get(hw.Window)# 某个窗口需要输出成动画win.publishFormat = "gif"hw.evalHWC('report sessionreport export presentation E:/report.pptx oneslideperwindow=true')## 使用report.hwxpptxtypes模块#import report.hwxpptxtypes as reportingrep_ses = reporting.ReportSession(name="Report Demo")#  presentation 相当于新建PPTpres = reporting.Presentation()# 导出分辨率pres.resolution = "Desktop"#  PPT模板pres.template = "C:/temp.pptx"# 截取图片capture = hw.CaptureImageTool()capture.type = "jpg"capture.width = 1920capture.height = 1080imgList = list()imgPath = "C:/image01.jpg"imgList.append(imgPath)capture.file = imgPathcapture.capture()## slide 相当于 新建一页幻灯片slide = reporting.Slide("Report Demo | Images",    presentation=pres,)# 幻灯片布局slide.layout("One Image with Caption")# 新建一个图片对象image = reporting.Image()image.path = imgPath# 将图片插入slide 相当于图片插入幻灯片slide.add(image, "pic1")# 保存 PPTpres.savePPTX("C:/temp_save.pptx",    open=True,    mode="write",)# 删除图片for img in imgList:    os.remove(img)rep_ses.reset()# 图片插入幻灯片另外一种方法image2 = reporting.Image()image2.path = "C:/123.gif"slideimage = reporting.SlideImage(name="pic2",image=image,slide=slide)
💡往期文章

CAE仿真 孔边网格必须分布偶数节点的一种解释

HyperMesh Python 二次开发 提高脚本运行速度的方法(以每个solid建立一个component为例)

HyperView 基于Tcl 二次开发常用功能合集

Hyperview云图显示各个零件屈服,断后延伸率,应力与屈服比值(应力归一化),失效应变归一化

HyperView Python 二次开发之动画自动录制,一键输出仿真结果视频

最新文章

随机文章