Bug 158805 - No way to enter free form MERGEFIELDS / MERGEFIELDS cut short after space or quote : needed for xdocreport
Summary: No way to enter free form MERGEFIELDS / MERGEFIELDS cut short after space or ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:docx, implementationError
Depends on:
Blocks: Fields
  Show dependency treegraph
 
Reported: 2023-12-21 12:08 UTC by openoffice@alk.org.lu
Modified: 2024-09-02 16:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test case showing how merge fields are mutilated by libreoffice (5.29 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-07-31 08:56 UTC, openoffice@alk.org.lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description openoffice@alk.org.lu 2023-12-21 12:08:53 UTC
Hi,

Libreoffice seems to have no way of entering free-form MERGEFIELDS, which would be needed when processing Word templates with xdocreport.

And, what's worse, when opening a .docx made using Microsoft Word in Libreoffice, which contains such free-form MERGEFIELDS intended for processing by xdocreport, these MERGEFIELDs are mutilated in several ways:
 1. they are cut short at a doublequote character
 2. they are cut short at a space character beyond a certain length of string before
Comment 1 Dieter 2024-01-01 14:43:59 UTC
Thank you for reporting the bug.  It seems,  you are using an old version of LO.  Could you please retest with actual version 7.6?

If the bug is still present, please add a sample file. Thank you

=> NEEDINFO
Comment 2 QA Administrators 2024-06-30 03:15:01 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2024-07-31 03:15:10 UTC Comment hidden (obsolete)
Comment 4 openoffice@alk.org.lu 2024-07-31 08:56:06 UTC
Created attachment 195619 [details]
test case showing how merge fields are mutilated by libreoffice

Example file showing the issue. It contains 2 mergefields, one with a "quotedstring", and another one with a long list of words.

Just opening it in Libreoffice, and saving it under a different name mutilates both mergefields:

- "quotedstring" loses its quotes, and becomes quotedstring
- the other one is cut short after the first space, keeping only 0123, and losing 456 789 abc def ghi

Mergedfields with quotes and/or spaces are useful for the xdocreport template processor, and Microsoft Word preserves them just fine.
Comment 5 openoffice@alk.org.lu 2024-07-31 08:57:54 UTC
problem still happens in 24.2.5.2 (btw, why can't I copy-paste this from the About box?)
Comment 6 Buovjaga 2024-09-02 11:18:16 UTC
(In reply to openoffice@alk.org.lu from comment #4)
> Created attachment 195619 [details]
> test case showing how merge fields are mutilated by libreoffice
> 
> Example file showing the issue. It contains 2 mergefields, one with a
> "quotedstring", and another one with a long list of words.
> 
> Just opening it in Libreoffice, and saving it under a different name
> mutilates both mergefields:
> 
> - "quotedstring" loses its quotes, and becomes quotedstring
> - the other one is cut short after the first space, keeping only 0123, and
> losing 456 789 abc def ghi
> 
> Mergedfields with quotes and/or spaces are useful for the xdocreport
> template processor, and Microsoft Word preserves them just fine.

I opened the file in LibreOffice and office.com and it looks the same:

This is a test
0
merge field 1
0

with the zeros being mail merge fields.

Saved under a different name in LibreOffice and opened in office.com, it still looks the same.

Help me out here, what exactly should I be observing in the document?

(In reply to openoffice@alk.org.lu from comment #5)
> problem still happens in 24.2.5.2 (btw, why can't I copy-paste this from the
> About box?)

You mean you clicked the copy button to the right of "Version Information" and the info wasn't copied to your clipboard?

Arch Linux 64-bit
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 77aa9c210ad79af443191860ee1a7233d2d007cf
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 2 September 2024
Comment 7 openoffice@alk.org.lu 2024-09-02 12:57:59 UTC
When (In reply to Buovjaga from comment #6)
> (In reply to openoffice@alk.org.lu from comment #4)
> > Created attachment 195619 [details]
> > test case showing how merge fields are mutilated by libreoffice
> > 
> > Example file showing the issue. It contains 2 mergefields, one with a
> > "quotedstring", and another one with a long list of words.
> > 
> > Just opening it in Libreoffice, and saving it under a different name
> > mutilates both mergefields:
> > 
> > - "quotedstring" loses its quotes, and becomes quotedstring
> > - the other one is cut short after the first space, keeping only 0123, and
> > losing 456 789 abc def ghi
> > 
> > Mergedfields with quotes and/or spaces are useful for the xdocreport
> > template processor, and Microsoft Word preserves them just fine.
> 
> I opened the file in LibreOffice and office.com and it looks the same:
> 
> This is a test
> 0
> merge field 1
> 0
> 
> with the zeros being mail merge fields.
> 
> Saved under a different name in LibreOffice and opened in office.com, it
> still looks the same.
> 
> Help me out here, what exactly should I be observing in the document?

You can use Control-F9 to toggle between the display of the merge field and what it expands to, both in Microsoft Word and Libreoffice. When viewing the _definition_, you'll see that it is cut short from what is actually stored in the docx file.

> 
> (In reply to openoffice@alk.org.lu from comment #5)
> > problem still happens in 24.2.5.2 (btw, why can't I copy-paste this from the
> > About box?)
> 
> You mean you clicked the copy button to the right of "Version Information"
> and the info wasn't copied to your clipboard?

I couldn't select any text, the "About..." window wouldn't react at all to dragging over it.

> 
> Arch Linux 64-bit
> Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: 77aa9c210ad79af443191860ee1a7233d2d007cf
> CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
> Locale: fi-FI (fi_FI.UTF-8); UI: en-US
> Calc: CL threaded
> Built on 2 September 2024
Comment 8 Buovjaga 2024-09-02 16:16:21 UTC
(In reply to openoffice@alk.org.lu from comment #7)
> You can use Control-F9 to toggle between the display of the merge field and
> what it expands to, both in Microsoft Word and Libreoffice. When viewing the
> _definition_, you'll see that it is cut short from what is actually stored
> in the docx file.

Ok, thanks, so View - Field Names.

They started to be imported as fields in version 4.3 and the names are truncated already in that version. Let's set to NEW based on that.

> > 
> > (In reply to openoffice@alk.org.lu from comment #5)
> > > problem still happens in 24.2.5.2 (btw, why can't I copy-paste this from the
> > > About box?)
> > 
> > You mean you clicked the copy button to the right of "Version Information"
> > and the info wasn't copied to your clipboard?
> 
> I couldn't select any text, the "About..." window wouldn't react at all to
> dragging over it.

Yes, just click the button to copy.
Comment 9 openoffice@alk.org.lu 2024-09-02 16:24:14 UTC
(In reply to Buovjaga from comment #8)
> (In reply to openoffice@alk.org.lu from comment #7)
> > You can use Control-F9 to toggle between the display of the merge field and
> > what it expands to, both in Microsoft Word and Libreoffice. When viewing the
> > _definition_, you'll see that it is cut short from what is actually stored
> > in the docx file.
> 
> Ok, thanks, so View - Field Names.
> 
> They started to be imported as fields in version 4.3 and the names are
> truncated already in that version. Let's set to NEW based on that.

Thanks. Glad to see that this is finally moving :-)

> 
> > > 
> > > (In reply to openoffice@alk.org.lu from comment #5)
> > > > problem still happens in 24.2.5.2 (btw, why can't I copy-paste this from the
> > > > About box?)
> > > 
> > > You mean you clicked the copy button to the right of "Version Information"
> > > and the info wasn't copied to your clipboard?
> > 
> > I couldn't select any text, the "About..." window wouldn't react at all to
> > dragging over it.
> 
> Yes, just click the button to copy.

Tried that (just in case, it's just the highlighting that is missing), but that just pastes whatever I had selected elsewhere previously :-(
Comment 10 Buovjaga 2024-09-02 16:25:38 UTC
(In reply to openoffice@alk.org.lu from comment #9)
> (In reply to Buovjaga from comment #8)
> > Yes, just click the button to copy.
> 
> Tried that (just in case, it's just the highlighting that is missing), but
> that just pastes whatever I had selected elsewhere previously :-(

It has a quirk that you need to leave the About dialog open while you paste.
Comment 11 openoffice@alk.org.lu 2024-09-02 16:36:53 UTC
(In reply to Buovjaga from comment #10)
> (In reply to openoffice@alk.org.lu from comment #9)
> > (In reply to Buovjaga from comment #8)
> > > Yes, just click the button to copy.
> > 
> > Tried that (just in case, it's just the highlighting that is missing), but
> > that just pastes whatever I had selected elsewhere previously :-(
> 
> It has a quirk that you need to leave the About dialog open while you paste.

Nope, still happens even if I leave the about dialog open the entire time until I paste.

Interestingly enough, elsewhere in libreoffice, copy-paste works just fine. Even if I paste only after I closed libreoffice.