Try the fastest and simplest way to install ONLYOFFICE

Viewing a file overwrites external changes.

Viewing a file overwrites external changes.

Postby chinicuin » Mon May 28, 2018 8:58 pm

Hello.
I tried to edit one PPTX document "externally" following this steps:
1. I created a PPTX file and opened using Document Editor (DE) based on this example: https://api.onlyoffice.com/editors/basic
2. I closed the DE window, so the changes can be saved.
3. I Created a .docbuilder script like this one:

Code: Select all
builder.SetTmpFolder("TempFolder");
builder.OpenFile("/hdd/myFolder/output.pptx");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
builder.SaveFile("pptx", "/hdd/myFolder/output.pptx");
builder.CloseFile();


4. The code above erase all the elements in the first slide.
I open the file after running the script and the changes were applied correctly. But I open the same file from the DE and the document opens without the changes applied with the Document Builder.
I'am missing something in the script so the changes can be saved permanently in the document.

Thank you in advance.
chinicuin
 
Posts: 7
Joined: Thu Feb 15, 2018 8:02 pm

Re: Viewing a file overwrites external changes.

Postby Maxim » Tue May 29, 2018 7:47 am

Hello chinicuin!
But I open the same file from the DE and the document opens without the changes applied with the Document Builder.

I suppose you open the file from the Document Server's cache. Every time when you edit the file and want to save this file it needs to generate a new key for the file.
Maxim
 
Posts: 1593
Joined: Tue Oct 11, 2016 2:34 pm

Re: Viewing a file overwrites external changes.

Postby chinicuin » Tue Jun 05, 2018 4:53 pm

Thanks for the answer.
I'm not editing the document from the document viewer. I edited the document with two methods:
1. Using Apache POI to insert text on the document.
2. Using document builder to remove all objects from the first slide.

In both cases the document is edited correctly, but when is opened in the viewer the document came back to the state saved before the changes.

The document was open the first time and edited in the document viewer. But I need to insert a serial number at the bottom of each slide (this is exactly the change I trying to do externally).
chinicuin
 
Posts: 7
Joined: Thu Feb 15, 2018 8:02 pm


Return to Documents

Who is online

Users browsing this forum: Bing [Bot] and 0 guests