Estimated read time: 3 minutes
Writer now supports titles and tags for content controls, which helps providing context for the filled in text even if the placeholder text is replaced already.
This work is primarily for Collabora Online, see the previous post for background.
Motivation¶
Once several content controls are added to a document, it's easy to forget what was the exact purpose of what content control. Think of a press release for example – those regularly start with a location and a date, but once this information is provided, one no longer knows which content control was for which content.
Titles solve this problem for the user: similar to Writer's header/footer buttons, this button appears when you enter the content control and reminds you what content is expected there, even if the placeholder is already replaced.
Tags serve a similar purpose, but they are unique, machine-readable keys or identifiers, so once the form is filled in, an external consumer can easily extract the information from the document, given a specific tag.
Results so far¶
Titles (also known as aliases) and tags are now not only preserved, but also we have a UI to create, show, edit and delete them. This is available in the desktop rendering and also in the LOK API.
Somewhat related, in case a content control breaks into multiple lines or has formatting to break into multiple text portions, we now only emit one PDF widget for it, taking the description of the widget from the content control's title.
The last related improvement is that now we handle data binding for date content controls, which means that you can specify a timestamp, a language and a date format, and we'll format that timestamp and update the content control's string value at import time from DOCX.
How is this implemented?¶
If you would like to know a bit more about how this works, continue reading... :-)
As usual, the high-level problem was addressed by a series of small changes:
- sw content controls: preserve alias
- sw content controls: preserve tag
- sw content controls: emit only one PDF widget for multiple text portions
- tdf#151190 sw content controls: make them read-write in protected sections
- sw content controls: add rendering for the alias
- sw content controls, alias and tag: add ODT filter
- sw content controls, alias and tag: add UI
- sw content controls, alias: add LOK API
- sw content controls, alias: add PDF export
- sw content controls: enable data binding for date
Want to start using this?¶
You can get a snapshot / demo of Collabora Office 22.05 and try it out yourself right now: try the unstable snapshot. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (7.5).