ONLYOFFICE / DocumentServer

ONLYOFFICE Docs is a free collaborative online office suite comprising viewers and editors for texts, spreadsheets and presentations, forms and PDF, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
https://www.onlyoffice.com
GNU Affero General Public License v3.0
4.76k stars 1.08k forks source link

Click on Template file -> Create Document #2839

Open tbsbdr opened 1 month ago

tbsbdr commented 1 month ago

This issue is unique.

Your idea.

Userstory

As a user I want to create a document by clicking on a template file so that I can use the templates from a shared folder.

Flow

( pasting here @ibnpetr 's proposal: )

  1. When interacting with a DOTX file (double-clicking, selecting an item in the context menu, hidden opening, or any other logic for opening from a template), a DOCX file without content should be “created.”
  2. The storage (OCIS) should determine the location of the DOCX file: the current or root user folder, or any alternative folder for opening from templates.
  3. It is important that this file can be manipulated like a regular file (CheckFileInfo, Lock, PutFile) except for GetFile. Instead of GetFile, a link to the DOTX template should be sent in the CheckFileInfo response (TemplateSource field).
  4. Immediately open this file for editing. OO Docs will convert the template to DOCX and place the DOCX file in the storage using PutFile.
  5. Further editing will proceed as with a regular DOCX file.

Note:

butonic commented 1 month ago

Do I understand correctly that we create an empty DOCX file to a location writeable by the user and fill a new TemplateSource property in the GetFileInfo response with a URL to the DOTX template? onlyoffice would detect that new parameter, fetch the template and fill the DOCX file accordingly?

If so, I see no problems with this approach. We would have to store the template in the wopi session and add some code to handle the opening and creation logic. All good.

ibnpetr commented 1 month ago

Do I understand correctly that we create an empty DOCX file to a location writeable by the user and fill a new TemplateSource property in the GetFileInfo response with a URL to the DOTX template? onlyoffice would detect that new parameter, fetch the template and fill the DOCX file accordingly?

Yes, you can either create a new empty file or copy the template file itself, which is an alternative method used by other vendors. A new file will be created from the TemplateSource file.

tbsbdr commented 3 weeks ago

cc @micbar

micbar commented 2 weeks ago

After discussion with oC colleagues, we have a vague idea how to implement that.

We should use the app provider /app/new Action to create the new file in the personal space of the user with a server choosen name (File name and user-friendly datetime). Then we can open that via /app/open with the selected template in the wopi CheckFileInfo response.