Hi Team,
Actually thanks for docx4j for the replaceVariable method which has made my life easier . Now I have an PPTX template in which i would like to add\replace an image based on some condition.
I already used variableReplace() and replaced all my text content. Now please please let me know how can i add an image to the pptx or replace it in an easier way. I'm eagerly waiting for an positive response.
I tried to use the same text replacement method but i got the below error,
19403 [main] WARN org.docx4j.XmlUtils - Invalid key 'Schedule</a:t></a:r><a:r><a:rPr lang="en-US" altLang="de-DE" sz="1000" smtClean="0"><a:solidFill><a:srgbClr val="000000"/></a:solidFill></a:rPr><a:t>' or key not mapped to a value
Code,
File image = new File("C:\\Work\\24Jun2018\\IT\\images\\adobe.gif");
String str = FileUtils.readFileToString(image);
HashMap<String, String> mappings = new HashMap<String, String>();
mappings.put("Schedule", str);
slide.variableReplace(mappings);
Please let me know how to proceed.
PPT file attached for reference
With Regards,
Saranya