0

I have a requirement involving making a large pptx file with loads of charts, images and tables dynamic. This pptx has default styles. Is there any library or method to make a template so that I can insert the dynamic parts. Like docxtpl library allows us to input a dict and generate a docx file.

Thanks.

2
  • Welcome to Stack Overflow.! Questions that ask for software/library recommendations are typically too broad and are not a good fit for this site because any answer is generally just an opinion.. Give a good read over Where to Start, and Minimal Reproducible Example then edit your post. Commented Aug 5, 2021 at 23:42
  • Are you generating new documents dynamically, or are you editing an extant document? Python-pptx will create new slides in a PPT file where the default styles are preset, but there's a lot of settings you'll have to create methods for to fine tune the document to exactly the standards you need. Commented Aug 10, 2021 at 17:36

2 Answers 2

1

You can try the following python modules:

  1. https://pypi.org/project/template-pptx-jinja/
  2. https://pypi.org/project/pptx-template-simple/
  3. https://pypi.org/project/python-pptx-templater/

With the first one, the example they show, it works fine, but im having trouble applying it in another custom ppt.. keep getting "Unepexpected end of template".

The third one didint work for me though, maybe you have more luck.. and now i will try the second one.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure I understand your problem...

python-pptx (a tag you've used) is the fundamental programmable way to build a presentation - whether from a "template presentation or not.)

I hope nobody will mind me advertising my md2pptx open source project for taking Markdown and images and making a presentation.

However, I think md2pptx doesn't help you unless you have a way of turning graphs into eg PNG files - and I suspect that's not what you want.

5 Comments

I think you and OP don't mean the same thing with "template". In Powerpoint, a template contains style information that is applied to all slides (I think this is what you are talking about). Whereas template also describe (text-) files containing tags that can be automatically replaced with variables, see for example jinja from which docxtpl is inspired (this is what OP means)
Then, with the restrictions that md2pptx has, it might be the right approach: 1. Create the Markdown file, doing substitutons. 2. Throw the file through md2pptx. I'm not trying to push md2pptx, by the way. I'm just thinking of ways of creating a presentation automatically. In my case I use a Keyboard Maestro (on Mac) macro to create a hierarchy of subfolders with all I need, including tailored make files, to build a complete set of presentations from Markdown. (In my case the actual results of my thinking get typed into BBEdit but in the OP's use case they could be generated by code)
I see. Making a markdown/jinja template, processing it with jinja and then converting with md2pptx could be a workaround.
Right. But only if the OP is OK with eg not being able to create a chart directly in md2pptx. (It is constrained by what Markdown will allow - and I haven't figured out a syntax for specifying a live graph rather than embedding an image of a graph.)
@MartinPacker Ill have a look at the repo, and thanks for the suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.