Coreoz / PPT-Templates

PPT Template is a small templating library to generate PowerPoint presentations.
Apache License 2.0
30 stars 12 forks source link

Trailing Slash in url Replacment #4

Open daltonch opened 4 years ago

daltonch commented 4 years ago

Is there a way to use another field for the image replacement? In my version of Powerpoint 16.38 (osx) when I put in a url replacement variable $/image1/ it get replaced to $/image1 and therefore never gets swapped out from the template.

daltonch commented 4 years ago

Seems like if I put a \ at the end it works.

amanteaux commented 4 years ago

Hi @daltonch, Thank you for your interest in this library!

You are right, configure this might be a good addition. To be sure, can you confirm this behavior:

try(FileOutputStream out = new FileOutputStream("generated.pptx")) {
  new PptMapper()
    .variableCharDelimiter("|")
    .text("title", "Hello")
    .text("subtitle", "World!")
    .processTemplate(PptTemplateDemo.class.getResourceAsStream("/title.pptx"))
    .write(out);
}

So you would be able to use $|title| in your presentation, and it would correctly be replaced by Hello.