ONLYOFFICE / DesktopEditors

An office suite that combines text, spreadsheet and presentation editors allowing to create, view and edit local documents
https://www.onlyoffice.com
Other
2.83k stars 322 forks source link

[Feature] Support variables #100

Open blaggacao opened 6 years ago

blaggacao commented 6 years ago

As a generator of repeatable business documents, like contracts, I want to be able to set global variables which will be inserted/replaced throughout the document.

blaggacao commented 6 years ago

See Doc Variables by https://www.soliddigital.com/ for Google Docs

blaggacao commented 6 years ago
How it works
Enter variables into your doc by using the syntax: ${variable_name}

Variables can also be defined as different types of inputs by adding '::date' or '::options' or '::textarea' or '::file' to the variable name.

NEW! Import content from other documents into your template using the ::file type.

Examples:
"First of all, we would like to thank you and the rest of the team at ${Official Company Name}. We are honored to be considered for the ${Project Name} project."

"Date of submission ${Submission Date::date::'MM d, yy'}."

"Contract valid for ${Validity::options::Five (5),Ten (10),Fifteen (15)} days."

"Description of work: ${Work Description::textarea}"

"Case Study: ${Case Study::file}"

Applying Variables:
Once variables have been added to your document, click the "Reload" button (above). Doc Variables will scan your document and display a list of form fields for each of your variables.

Enter your variable assignments into the generated form fields.
Select 'Apply variables in a new document' if you wish to create a copy of your document before assignments are processed.
Click 'Apply Variables' when ready.
Tip: If you want to create a unique document name, add a variable in the title of your template!

Date Formatting Options:
Thank you for all the requests to add in this feature! If you leave the format portion out it will default to "mm/dd/yy".

${Variable Name::date::'mm/dd/yy'}

Important: Make sure you have quotes around your format.

d - day of month (no leading zero)
dd - day of month (two digit)
o - day of year (no leading zeros)
oo - day of year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
'...' - literal text
'' - single quote
flaminestone commented 6 years ago

Hello @blaggacao. You can do it by documentbuilder or by plugin (you need to create it). See documentation

blaggacao commented 6 years ago

@flaminestone ~I thought of that possibility...~ Thanks for the documentbuilder tipp. That's something really amazing!! Strange I didn't find that on my first look around.

I cannot give this high prio at the moment, but I'm seriously evaluating onlyoffice as a libreoffice alternative. If, though, I get my hands dirty, I'll make sure to feed that back somhow to you guys...