Examples#

Example 01 - Creating a PPTX report with a single screenshot#

Code to create a PPTX report#
 1import hw
 2import hm
 3import os
 4
 5import hw.report.hwxpptxtypes as reporting
 6
 7rep_ses = reporting.ReportSession(name="ReportLooper")
 8pres = reporting.Presentation()
 9pres.resolution = "HD"
10pres.template = os.path.join(
11    hm.altair_home, "mv/scripts/tcl/report/templates/pptTemplate.pptx"
12)
13
14capture = hw.CaptureImageTool()
15capture.type = "jpg"
16capture.width = 1920
17capture.height = 1080
18
19imgList = list()
20imgPath = "C:/Temp/image01.jpg"
21imgList.append(imgPath)
22capture.file = imgPath
23capture.capture()
24
25slide = reporting.Slide(
26    "Report Looper | Images",
27    presentation=pres,
28)
29slide.layout("One Image with Caption")
30
31image = reporting.Image()
32image.path = imgPath
33slide.add(image, "pic1")
34
35pres.savePPTX(
36    "C:/Temp/report_test.pptx",
37    open=True,
38    mode="write",
39)
40
41for img in imgList:
42    os.remove(img)