Bug 156061 - Paragraph that contains mergeFields with white space disappears
Summary: Paragraph that contains mergeFields with white space disappears
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected
Depends on:
Blocks: Paragraph
  Show dependency treegraph
 
Reported: 2023-06-26 13:42 UTC by Hector
Modified: 2023-07-09 09:32 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
File with the problem (30.29 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-26 13:43 UTC, Hector
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hector 2023-06-26 13:42:54 UTC
Description:
I have a problem with mergeFields.
If the value is white space, the text disappears.
In LibreOffice the entire paragraph that contains it disappears.
In WordPad works perfectly.

Steps to Reproduce:
1. Open a file with mergeFields the contains white space


Actual Results:
Only 3 paragraphs appear in the document

Expected Results:
4 paragraphs should appear in the document


Reproducible: Always


User Profile Reset: No

Additional Info:
4 paragraphs should appear in the document
Comment 1 Hector 2023-06-26 13:43:45 UTC
Created attachment 188094 [details]
File with the problem
Comment 2 Hector 2023-06-26 13:45:05 UTC
I Have a problem with mergeFields.
If the value is white space, the text disappears.
In LibreOffice the entire paragraph that contains it disappears.
In WordPad works perfectly.

I add file here.
Comment 3 Julien Nabet 2023-06-26 13:46:25 UTC Comment hidden (obsolete)
Comment 4 Mike Kaganski 2023-06-26 14:03:08 UTC
Likely related to commit db04be037b611e296ef9f2542322c52ed82d7a2b.
However, the function that checks if the paragraph should be hidden only checks that field text is empty - i.e., no characters. Some whitespace is not empty, so should not make it hidden. Thus, it is likely an import issue, turning whitespace into nothing.

Interesting, if it worked between 6.1 (where the feature was implemented) and 7.5?
Comment 5 Hector 2023-06-26 15:21:10 UTC
I have only tested it in version 7.5
Comment 6 Stéphane Guillou (stragu) 2023-06-26 19:03:12 UTC
(In reply to Mike Kaganski from comment #4)
> Likely related to commit db04be037b611e296ef9f2542322c52ed82d7a2b.
> However, the function that checks if the paragraph should be hidden only
> checks that field text is empty - i.e., no characters. Some whitespace is
> not empty, so should not make it hidden. Thus, it is likely an import issue,
> turning whitespace into nothing.
> 
> Interesting, if it worked between 6.1 (where the feature was implemented)
> and 7.5?

Testing with "Tools > Options > Writer > Compatibility > Hide paragraphs of database fields" on:

- 6.1 build at db04be037b611e296ef9f2542322c52ed82d7a2b shows the paragraph.
- starts being hidden in 7.2

I had to bisect in --safe-mode.
Bibisected with linux-64-7.2 repo to first bad commit 426308e0d943e62cfe25211ced21fa90c02a97ac which points to core commit:

commit ac14ed9f26582701032a28cb424f2b6bf35ca7fd
author	Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>	Wed Dec 09 09:11:24 2020 +0100
committer	Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>	Thu Dec 10 16:50:42 2020 +0100
Don't show HiddenParagraphs by default
Showing them means that the layout is different from what is printed.
This probably shouldn't be the default.
The similiar HiddenCharacter is also false by default.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107385

I don't understand the feature(s) enough to judge if that was by design.

Samuel and Mike?
Comment 7 Mike Kaganski 2023-06-27 05:50:28 UTC
(In reply to Stéphane Guillou (stragu) from comment #6)

Thank you; the setting changed in that commit is about showing *on screen*.
The file, when opened in Word, has that paragraph shown even on print preview.

In Writer 6.1, it hides the paragraph on print preview, so no need to bisect further.
Comment 8 Mike Kaganski 2023-07-09 09:32:51 UTC
It looks like the feature implemented in bug 35798 Needs fixing. Empty mail merge fields should not hide anything in the source document; only the merge itself should perform the hide.

FTR: Word seems to only hide when the paragraph after the merge only contains whitespace. So paragraphs with labels in plain text (not as Word's merge field's \b argument) would not hide; and fields containing space (not exactly empty) would hide. I am unsure if this exact processing should be implemented; anyway, even if, it's separate.