Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created September 17, 2022 13:19
Show Gist options
  • Save samirsaci/26007ecdfcfbe755a91dfaa3bfed7c2a to your computer and use it in GitHub Desktop.
Save samirsaci/26007ecdfcfbe755a91dfaa3bfed7c2a to your computer and use it in GitHub Desktop.
Automate PPT
# Add Analysis lines
total_orders, LIST_ANALYSIS = plot_split(df_lior)
# Create a slide
slide = prs.slides.add_slide(image_slide_layout)
shapes = slide.shapes
# Create Title
title_shape = shapes.title
title_shape.text = 'Order Profile'
# Add Image
left = Inches(0.75)
top = Inches(1.25)
pic = slide.shapes.add_picture('{}.png'.format('SPLIT'), left, top, height=Inches(4.5))
# Build the Text Box
left = Inches(0.75)
top = Inches(1.5) + Inches(4)
width = Inches(9)
height = Inches(2)
txBox = slide.shapes.add_textbox(left, top, width, height)
tf = txBox.text_frame
p = tf.add_paragraph()
p.text = '{} prepared'.format(total_orders)
p.font.size = Pt(18)
for l in LIST_ANALYSIS:
# First bullet point
p = tf.add_paragraph()
p.text = '• {}'.format(l)
p.level = 1
# Add Pages
txBox = slide.shapes.add_textbox(Inches(9), Inches(6.75), Inches(1), Inches(1))
tf = txBox.text_frame
p = tf.add_paragraph()
p.text = str('{}/{}'.format(page, len(LIST_WEEKS) +1))
p.font.size = Pt(15)
page += 1
# Save
prs.save('Warehouse Workload Report.pptx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment