Bug 50097 - FILESAVE: FORMCONTROLS: Form controls not saved in .docx
Summary: FILESAVE: FORMCONTROLS: Form controls not saved in .docx
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Tamás Zolnai
URL:
Whiteboard: target:6.0.0
Keywords: filter:doc, filter:docx
: 35836 52191 54235 70302 75654 75893 99775 102024 (view as bug list)
Depends on:
Blocks: DOCX-Forms
  Show dependency treegraph
 
Reported: 2012-05-18 08:20 UTC by some.bananas1234
Modified: 2017-12-24 10:07 UTC (History)
24 users (show)

See Also:
Crash report or crash signature:


Attachments
TextEdit reproducer file (19.04 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-12-09 10:43 UTC, Timur Sattarov
Details
Test ODT file with Form Controls: checkbox, textbox, pushButton, and optionButton (10.54 KB, application/vnd.oasis.opendocument.text)
2016-02-25 02:35 UTC, Kevin Suo
Details
Form controls supported by Word 2013 (27.16 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-05-15 05:52 UTC, Gabor Kelemen
Details
Form controls supported by LO 5.3 (14.81 KB, application/vnd.oasis.opendocument.text)
2017-05-15 05:53 UTC, Gabor Kelemen
Details
Form controls supported by LO 5.3 - saved in docx (14.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-05-15 05:57 UTC, Gabor Kelemen
Details
Form controls supported by LO 5.3 - saved in doc (62.00 KB, application/msword)
2017-05-15 05:58 UTC, Gabor Kelemen
Details
ODT Form Controls (75.98 KB, application/vnd.oasis.opendocument.text)
2017-05-16 01:23 UTC, Yousuf Philips (jay) (retired)
Details
Writer file with controls from Dutch user (14.56 KB, application/vnd.oasis.opendocument.text)
2017-05-16 10:11 UTC, Cor Nouws
Details
3 checkbox controls (22.44 KB, application/wps-office.docx)
2017-08-21 13:03 UTC, Yousuf Philips (jay) (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description some.bananas1234 2012-05-18 08:20:48 UTC
How to reproduce
----------------
1. Create/open a document
2. Add a checkbox (from Form Controls toolbar)
3. Save file as .docx (Microsoft 2007/2010 XML)
4. Close document
5. Open the .docx document
6. The checkbox is missing



If I create a docx in MS Word 2010, I see the following XML in word/document.xml;


      <w:sdt>
        <w:sdtPr>
          <w:id w:val="129679277"/>
          <w14:checkbox>
            <w14:checked w14:val="0"/>
            <w14:checkedState w14:val="2612" w14:font="MS Gothic"/>
            <w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/>
          </w14:checkbox>
        </w:sdtPr>
        <w:sdtContent>
          <w:r>
            <w:rPr>
              <w:rFonts w:ascii="MS Gothic" w:eastAsia="MS Gothic" w:hint="eastAsia"/>
            </w:rPr>
            <w:t>☐</w:t>
          </w:r>
        </w:sdtContent>
      </w:sdt>
Comment 1 Joel Madero 2012-10-30 18:54:35 UTC
Confirmed. Marking as NEW and Prioritizing

Minor: Can prevent users from using a feature under certain circumstances. Feature is not very common and only happens when saving as a .docx. If this problem occurs with documents saved WITHIN excel and then brought into LibO please attach a document created in Excel and I'll test it and possibly raise the importance.

Low: Not many users use checkboxes, coupled with the fact that most people using LibO don't save as a .docx. 

Thanks for reporting
Comment 2 Samuel Mehrbrodt (CIB) 2014-01-23 14:08:20 UTC
Confirmed in 4.2.
Comment 3 Matthew Francis 2014-10-15 17:29:03 UTC
This is the oldest of numerous duplicate bugs, so I'm going to spruce this one up a little and close the others

- Updated summary to indicate that all form controls fail to be saved in .docx
- Upped importance to Medium / Major, as this is a feature that some users rely upon heavily
- This has never worked, so Version -> Inherited from Ooo
Comment 4 Matthew Francis 2014-10-15 17:31:09 UTC
Note: This bug should be used for the .docx form control issue only

There are also some different issues with form controls and .doc, but those should be dealt with separately
Comment 5 Matthew Francis 2014-10-15 17:31:50 UTC
*** Bug 52191 has been marked as a duplicate of this bug. ***
Comment 6 Matthew Francis 2014-10-15 17:32:37 UTC
*** Bug 54235 has been marked as a duplicate of this bug. ***
Comment 7 Matthew Francis 2014-10-15 17:33:20 UTC
*** Bug 70302 has been marked as a duplicate of this bug. ***
Comment 8 Matthew Francis 2014-10-15 17:33:41 UTC
*** Bug 75893 has been marked as a duplicate of this bug. ***
Comment 9 Matthew Francis 2014-10-15 17:34:12 UTC
*** Bug 75654 has been marked as a duplicate of this bug. ***
Comment 10 Joel Madero 2014-10-15 23:28:53 UTC
Hm - many users being affected should affect importance, not severity. In reality this should be a minor (slow down professional work but does not prevent) and perhaps high (or even highest if you think that is appropriate and add to MAB). 

See: https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg
Comment 11 Bill Robertson 2014-10-17 03:44:46 UTC
Regarding the comment: "Low: Not many users use checkboxes, coupled with the fact that most people using LibO don't save as a .docx":

1/ Checkboxes are (unfortunately) used in our corporate forms

2/ In a business environment, docx support is (again unfortunately) an expected expected feature for office productivity applications

3/ Our end-users perceive this as a data-loss issue

Thanks
Comment 12 Joel Madero 2014-10-17 03:59:47 UTC
none of which are objective standards . . . http://joelmadero.wordpress.com/2014/10/11/user-expectations-and-the-reality-of-our-community/

If you're using LibreOffice, built by volunteers, to make money, I suggest considering getting a support package.
Comment 13 Zeki Bildirici 2014-10-21 11:34:23 UTC
(In reply to Joel Madero from comment #12)
> none of which are objective standards . . .
> http://joelmadero.wordpress.com/2014/10/11/user-expectations-and-the-reality-
> of-our-community/
> 
> If you're using LibreOffice, built by volunteers, to make money, I suggest
> considering getting a support package.

Hi,

Just to note, formcontrols used not only in corporations and public administrations, Non Governmental Organizations, schools- teachers, students use it to create fillable forms. 

IMHO, i see this as another basic functionality which differs LO Writer from a text editor to being a part of a productivty suite.

Btw, opening an issue in freedomsponsrts.org can be alternative catalyst for long lasting bugs: https://freedomsponsors.org/project/149/LibreOffice 


Best regards,
Zeki
Comment 14 Joel Madero 2014-10-21 13:41:10 UTC
Respectfully - everyone who reports a bug and doesn't want to consider getting support and wants to get volunteers to fix their issue for free immediately will say exactly what you just said.
Comment 15 gregor3000 2015-07-26 06:55:32 UTC
If you create the form in .docx and open it in Libre office it behaves normally. You can fill in the form. But when you save it it saves wrong (not as a form. Furthermore if you export it as PDF and specifically mark to keep the form style it doesn't do it.

In short:
- even if people that use libre office do not normally save as .docx they might have to do it when they exchange docs with people that use MS office (i.e. majority in the world)
- even if people do not save as .docx but would prefer to create a portable PDF form they will still fail.

Just because creators or triagers of LO do not use MS office or dela with people that do use it, it doesn't mean no one in the world does. therefore this can not be a low priority. Or rather it can be, if you want people to drop LO and use MS office instead when dealing with businesses and other organisations.
Comment 16 gregor3000 2015-07-26 07:22:19 UTC
One more thing:
Even if you save it in .odf it doesn't save propperly.
Comment 17 Timur Sattarov 2015-12-09 10:43:02 UTC
Created attachment 121160 [details]
TextEdit reproducer file

TextEdit field is not saved properly there. Libreoffice doesn't set control's content, instead it replaces placeholder text (it remains gray all the time)
Comment 18 Kevin Suo 2016-02-25 02:35:48 UTC
Created attachment 122973 [details]
Test ODT file with Form Controls: checkbox, textbox, pushButton, and optionButton

These form controls are not retained when save as DOCX.
Version: 5.1.1.1 (x64)
Build ID: c43cb650e9c145b181321ea547d38296db70f36e
Comment 19 Buovjaga 2016-05-13 05:26:57 UTC
*** Bug 99775 has been marked as a duplicate of this bug. ***
Comment 20 Alex Thurgood 2016-06-15 08:40:15 UTC
*** Bug 35836 has been marked as a duplicate of this bug. ***
Comment 21 daniel.oconnor 2016-08-15 11:30:17 UTC
Bug #45341 adds a test case which covers radio, checkbox, list and combo for this export problem.

In particular; the resulting .docx export from that produces:

<w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr/></w:pPr><w:r><w:rPr/></w:r><w:sdt><w:sdtPr><w:dropDownList><w:listItem w:displayText="Hello" w:value="Hello"/><w:listItem w:displayText="Goodbye" w:value="Goodbye"/></w:dropDownList></w:sdtPr><w:sdtContent><w:r/></w:sdtContent></w:sdt></w:p><w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr/></w:pPr><w:r><w:rPr/></w:r></w:p><w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr/></w:pPr><w:r><w:rPr/></w:r></w:p><w:p><w:pPr><w:pStyle w:val="Normal"/><w:rPr/></w:pPr><w:r><w:rPr/></w:r></w:p>

... simply substituting many of the controls for empty P (paragraph?) tags.

While not a complete fix, rendering different markup might result in basic controls being rendered without too much trouble.
Comment 22 Luke 2016-09-07 18:07:33 UTC
Added Miklos since he fixed the .doc version of this bug in Bug 45724.
Comment 23 Yousuf Philips (jay) (retired) 2017-05-10 04:18:04 UTC
@Kevin, @Daniel, @Regina, @Cor, @Stuart: It would be appreciated if one of you provided a odt with all form fields in it, so we can know which of them are not being export to docx as attachment 122973 [details] and attachment 126840 [details] arent a complete set.
Comment 24 Cor Nouws 2017-05-11 13:54:31 UTC
(In reply to Yousuf Philips (jay) from comment #23)
> @Kevin, @Daniel, @Regina, @Cor, @Stuart: It would be appreciated if one of
> you provided a odt with all form fields in it, so we can know which of them
> are not being export to docx as attachment 122973 [details] and attachment
> 126840 [details] arent a complete set.

asked @ the Dutch list - nice job for an enthusiast form user
Comment 25 Gabor Kelemen 2017-05-15 05:52:51 UTC
Created attachment 133320 [details]
Form controls supported by Word 2013

Example file with all form controls supported by Word 2013.
Comment 26 Gabor Kelemen 2017-05-15 05:53:44 UTC
Created attachment 133321 [details]
Form controls supported by LO 5.3
Comment 27 Gabor Kelemen 2017-05-15 05:57:53 UTC
Created attachment 133322 [details]
Form controls supported by LO 5.3 - saved in docx
Comment 28 Gabor Kelemen 2017-05-15 05:58:26 UTC
Created attachment 133323 [details]
Form controls supported by LO 5.3 - saved in doc
Comment 29 Yousuf Philips (jay) (retired) 2017-05-15 14:42:46 UTC
(In reply to Gabor Kelemen from comment #25)
> Created attachment 133320 [details]
> Form controls supported by Word 2013

In Word 2010 i also saw a Insert Frame entry under legacy form controls, does it not appear in 2013.

(In reply to Gabor Kelemen from comment #26)
> Created attachment 133321 [details]
> Form controls supported by LO 5.3

Thanks. I'll attempt to modify this to make a good test document with, as we cant have data being pulled from bibliography.

(In reply to Gabor Kelemen from comment #27)
> Created attachment 133322 [details]
> Form controls supported by LO 5.3 - saved in docx

Opening this in LO shows as if nothing is exported, but opening it in Word 2010 showed that the combobox and date fields were exported.
Comment 30 Yousuf Philips (jay) (retired) 2017-05-16 01:23:10 UTC
Created attachment 133345 [details]
ODT Form Controls

So here is the modified version of attachment 133321 [details] with variations of the various form controls. Exporting it to .docx showed the same result, though it did show that some properties that could be translated over in combobox and date field werent being exported, like whether it was disabled or the date format.
Comment 31 Cor Nouws 2017-05-16 10:11:07 UTC
Created attachment 133354 [details]
Writer file with controls from Dutch user
Comment 32 Aron Budea 2017-06-21 14:33:50 UTC
*** Bug 102024 has been marked as a duplicate of this bug. ***
Comment 33 Commit Notification 2017-08-17 21:12:20 UTC
Tamás Zolnai committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c0cc02e2934aeb12dda44818955e5964496c186a

tdf#50097: DOCX: export form controls as MSO ActiveX controls

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 34 Yousuf Philips (jay) (retired) 2017-08-21 11:12:43 UTC
Tamas: When saving to OOXML, shouldnt we export these form controls to the newer form controls available in Word 2007+ when possible, rather than legacy ActiveX controls?
Comment 35 Tamás Zolnai 2017-08-21 11:35:47 UTC
(In reply to Yousuf Philips (jay) from comment #34)
> Tamas: When saving to OOXML, shouldnt we export these form controls to the
> newer form controls available in Word 2007+ when possible, rather than
> legacy ActiveX controls?

I don't understand the question. As I see there are two kind of controls in MSO: legacy controls and ActiveX controls. As I now ActiveX controls are the newer one.
Comment 36 Yousuf Philips (jay) (retired) 2017-08-21 12:49:33 UTC
(In reply to Tamás Zolnai from comment #35)
> I don't understand the question. As I see there are two kind of controls in
> MSO: legacy controls and ActiveX controls. As I now ActiveX controls are the
> newer one.

There are three from what i understand and ActiveX is likely the oldest.
https://wordknowhow.files.wordpress.com/2013/06/untitled7.jpg
Comment 37 Tamás Zolnai 2017-08-21 12:57:04 UTC
(In reply to Yousuf Philips (jay) from comment #36)
> (In reply to Tamás Zolnai from comment #35)
> > I don't understand the question. As I see there are two kind of controls in
> > MSO: legacy controls and ActiveX controls. As I now ActiveX controls are the
> > newer one.
> 
> There are three from what i understand and ActiveX is likely the oldest.
> https://wordknowhow.files.wordpress.com/2013/06/untitled7.jpg

Can you send me a link where you get this information? It's just a picture.
Comment 38 Yousuf Philips (jay) (retired) 2017-08-21 13:03:52 UTC
Created attachment 135701 [details]
3 checkbox controls

(In reply to Tamás Zolnai from comment #37)
> Can you send me a link where you get this information? It's just a picture.

I get it from MS Word which i have installed on my pc, and sent a picture of what it looks like in the UI. I've attached a document with the 3 types of checkbox controls.
Comment 39 Tamás Zolnai 2017-08-21 13:56:53 UTC
(In reply to Yousuf Philips (jay) from comment #38)
> Created attachment 135701 [details]
> 3 checkbox controls
> 
> (In reply to Tamás Zolnai from comment #37)
> > Can you send me a link where you get this information? It's just a picture.
> 
> I get it from MS Word which i have installed on my pc, and sent a picture of
> what it looks like in the UI. I've attached a document with the 3 types of
> checkbox controls.

Ah, I see now. I missed the content control type. I chose ActiveX controls because it has similar properties to LO form controls. Now I checked the content controls and it also misses the properties ActiveX controls have.
For example in case of checkbox we have additional properties like tristate, wordwrap, background color, etc.. However it's a good idea to check for all control types whether which MSO type has the best match. For example a limitation of activeX controls is that they can't have predefined list items (e.g. combobox, lisbox), so list types might be better to use content controls, but for checkbox it seems the best to use ActiveX checkbox.
I also see that some LO control has no matching content control, but have ActiveX control (e.g. push button, option button, spin button, scroll bar).
Comment 40 Tamás Zolnai 2017-08-21 14:08:15 UTC
I also see that legacy and content controls are always placed inline as text, but LO form controls and MSO ActiveX controls can be floating objects (e.g. anchored to paragraph, or page).
Comment 41 Tamás Zolnai 2017-08-22 19:34:07 UTC
I close this bug now. Most of the controls are saved no to DOCX format as an activeX control, If there is any issue related to a specific control, it would be good to have a separate bug for that.
Comment 42 Luke 2017-08-28 19:37:21 UTC
I only see 2 remaining issues here with all of the test cases.

1) The checkbox selection issue should be fixed by Bug 91384. 
2) All the dropdown boxes are not exporting. But I think this is the correct behavior. It is not possible to create empty list for data validation in MS Office (an error is displayed during creation process). Please correct me if I am wrong.

Thank you Tamás Zolnai for all your hard work! This is a huge win for interoperability as I've seen these issues come up multiple times in real world work documents.
Comment 43 Luke 2017-08-28 19:39:28 UTC
Sorry the checkbox selection issue is Bug 99571
Comment 44 Cor Nouws 2017-12-24 10:07:04 UTC
(In reply to Cor Nouws from comment #31)
> Created attachment 133354 [details]
> Writer file with controls from Dutch user

I notice a difference in appearance of image buttons and image elements
Not saved are: date field, group box, navigation bar, and table element.
The vast majority is cute :)
Comment 45 Cor Nouws 2017-12-24 10:07:56 UTC
(In reply to Tamás Zolnai from comment #41)
> I close this bug now. Most of the controls are saved no to DOCX format as an

Thanks Tamáz!

Verified in Version: 6.1.0.0.alpha0+
Build ID: 99210a149c859fcd683870b280adaeeffd1250e4
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-12-17_23:57:18
Locale: nl-NL (nl_NL.UTF-8); Calc: group threaded