Created attachment 181587 [details] Example file from Word 2016 with a macro setting two variables Attached document has set two document variables from VBA macro: ActiveDocument.Variables.Add Name:="FullName", Value:=fName ActiveDocument.Variables.Add Name:="Unused", Value:=VarUnused Of these FullName is inserted into the document as a field, Unused is not. When this document is saved as DOCX or RTF and opened in Writer, the Unused variable is not imported, and so it would be lost upon save as well. 1, Open attached docx, rtf files in Word 2, Run the following macro: Sub GetDocVars() MsgBox ActiveDocument.Variables("FullName").Value & " " & ActiveDocument.Variables("Unused").Value End Sub This will show there are two document variables defined. 3, Open the docx, rtf files in Writer, go to the Fields dialog (Ctrl-F2), Variables tab. 4, Under User Field there is only the FullName variable listed with the correct Jeff Smith value. Expected: the Unused field is also imported with the "Hello World" value. Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community Build ID: 86b2bfd34a4f07c54f03c8c8dfe48e0810834628 CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: en-US (hu_HU); UI: en-US Calc: threaded
Created attachment 181588 [details] The example file saved as docx in Word 2016
Created attachment 181589 [details] The example file saved as rtf in Word 2016
Created attachment 181590 [details] Querying the document variables in Word with macro in the docx file
Created attachment 181591 [details] Querying the document variables in Word with macro in the rtf file
Created attachment 181592 [details] The Variables tab in Writer for the docx file
Created attachment 181593 [details] The Variables tab in Writer for the rtf file
Samuel Mehrbrodt committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f1adf4e4672b805fbda5682f4e0e6f08aed5ce79 tdf#150267 RTF: Import/Export unused document variables It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
RTF Import/Export is fixed with above commit. docx export was already implemented with this commit: https://cgit.freedesktop.org/libreoffice/core/commit/?id=ae5f469d3893de73850ccc369dbf426a4acd8f15 docx import is still missing as of today. Maybe open a new bug report for that?
Samuel Mehrbrodt committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/8d36537cea6d976e3fc2a8471d7f52660603839d tdf#150267 RTF: Import/Export unused document variables It will be available in 7.4.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Created attachment 182232 [details] attachment 181589 [details] in Word and Writer Checked RTF attachment 181589 [details] with: Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community Build ID: dc92a4d973086ce8a6a5f75ba0f4d4c9ca05537a CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: en-US (hu_HU); UI: en-US Calc: threaded Unfortunately only the unused variables name is imported, its value is still not.
Reopening: the "Unused" variable should have a value of "Hello World" in the Fields dialog, not 0.
Samuel Mehrbrodt committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/5eff45749464739706c9f25cca6c1edff3187f1d tdf#150267 Import docvar value correctly It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Samuel Mehrbrodt committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/f2c4ecbd38a274ca36db21a61ef7712b3db8ca87 tdf#150267 Import docvar value correctly It will be available in 7.4.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified in Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community Build ID: c0d09eb46665a0b2ab86f263cc95662f406d83d2 CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: hu-HU (hu_HU); UI: en-US Calc: threaded The value is now correctly imported.