How do I edit a PPTX file via Java while it is open in Microsoft PowerPoint? -


with reference poi - cannot write file while opened in excel?

the required functionality java application under development powerpoint version of above: using java, create slide , add content generated captured application data, add slide existing powerpoint file opened in microsoft powerpoint.

if no powerpoint file opened, java application first open microsoft powerpoint if necessary, create new, empty powerpoint file , open in microsoft powerpoint.

for example, application create test.pptx. application open in microsoft powerpoint application. next, add slide. operation succeeds , no exceptions thrown. however, changes not reflected in microsoft powerpoint view.

  • if close file in microsoft powerpoint , open again, updated changes can seen. however, not want. the user must able continuously add new slides , see these slides update microsoft powerpoint view on-the-fly without needing restart microsoft powerpoint application after each slide addition.
  • i have noticed when powerpoint file opened in microsoft powerpoint, ~$test.pptx temporary file created on desktop. tried java application add generated slides directly ~test.pptx filenotfoundexception: process cannot access file because being used process. subsequently thrown.

the application implemented using java 1.8, runs on windows 10, , uses microsoft office 2013. development on particular feature has begun scratch solutions still being sought , explored.

at present, using apache poi can switch away using if means solving problem. mooted try using microsoft office macros. idea still being explored not understand how use macros enough determine whether adequately meets our requirements.

how can implement required functionality? technologies or libraries need job done?

sample code taken tutorialspoint's apache poi ppt tutorial. existing powerpoint file should opened in microsoft powerpoint, , when below code run, need see added slides in microsoft powerpoint view immediately. reminder: using apache poi not mandatory.

public class editpresentation {   public static void main(string ar[]) throws ioexception{     //opening existing slide show     file file = new file("example1.pptx");     fileinputstream inputstream=new fileinputstream(file);     xmlslideshow ppt = new xmlslideshow(inputstream);      //adding slides slodeshow     xslfslide slide1 = ppt.createslide();     xslfslide slide2 = ppt.createslide();      //saving changes      fileoutputstream out = new fileoutputstream(file);     ppt.write(out);      system.out.println("presentation edited successfully");     out.close();       } }  


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -