Hidden paragraphs not working in mail merge

asked 2021-01-06 17:30:10 +0100

FAtristain gravatar image

updated 2021-01-13 20:53:02 +0100

I have two hidden paragraphs in my form letter. They depend on one of the fields of my database.

Even if I choose a different record in the database, the hidden paragraphs are not hidden.

My condition to hide the paragraphs states: ![Database.Table.Field]

However, when I display and/or print and say yes to make a form letter and create individual PDF files, they all contain every paragraph.

Is there is an option somewhere that I am missing? I have looked in the all the documentation and there is nothing related to "hidden paragraph".

Thanks for any help.

Federico

NOTE: This was previously reported as: "https://ask.libreoffice.org/en/questi..." but it was closed as not relevant or outdated.

NOTE: I am using version 6.4.7.2 C:\fakepath\Test writer file.odt C:\fakepath\Test list XLS file.xls

edit retag flag offensive close merge delete

Comments

May be your are talking about bug tdf#54703 - but I'm not quite sure, because the bug description started with "hidden sections" and in the course of comments it turns to "hidden paragraphs" as well.

There is another bug report tdf#134728 whose title "Saving into single files inside Mail Merge is ignoring hidden paragraphs" seems to fit your case, but is not set to NEW (hence not confirmed bug).

Opaque gravatar imageOpaque ( 2021-01-06 17:58:48 +0100 )edit

Is your document a .docx one? To the best of my knowledge, condition syntax does not use square brackets [ and ]. According to the built-in help, you should simply write ! Database.Table.Field.

ajlittoz gravatar imageajlittoz ( 2021-01-07 08:21:11 +0100 )edit

No @ajlittoz the document is an ".odt" file (i.e. a libre office Writer file).

FAtristain gravatar imageFAtristain ( 2021-01-08 02:45:05 +0100 )edit

@ajlittoz I also tried it without the [ and ] surrounding the paragraphs and it still did not work.

FAtristain gravatar imageFAtristain ( 2021-01-08 02:52:40 +0100 )edit

How's your condition entered? With a field associated to a hidden paragraph?

ajlittoz gravatar imageajlittoz ( 2021-01-08 07:54:35 +0100 )edit

Yes, I have a Database that has some names and addresses (i.e. fields like Street1, Street2, City, State, etc.), however there are some addresses (i.e. Street1) are missing. The name of the Database is "Addresses" and the Table name is "Letters," therefore my formula is ![Addresses.Letters.Street1] (note that I also tried without the square brackets per comment above). I use this formula at the end of the paragraph(s) to be skipped.

In such way that I should get the following results when there is an address: John Doe Street1 Street2 City, Zip Code State

Dear John...

But I should get the following results when there is no address: John Doe

Dear John...

Instead what I get when there is no address: John Doe

,

Dear John...

Note that it is not eliminating/skipping those paragraphs that are empty based on the fact that Street1 in Table ...(more)

FAtristain gravatar imageFAtristain ( 2021-01-09 18:40:34 +0100 )edit

Edit your question to attach a sample file. Hidden paragraphs are not trivial. It is important to see how you configured your field.

ajlittoz gravatar imageajlittoz ( 2021-01-09 20:46:44 +0100 )edit

I think this is related to bug 54703 and 134728 as mentioned above.

What is actually happening is that when you create individual files, it's just making a "copy" of the master document instead of generating the "flattened" versions with the fields filled in and removed. I only see this behaviour when I create the document using a BASIC macro though, not in the front-end.

One thing you could do, to see if it improves things for you exporting to PDF, is go to Tools > Options > LibreOffice Writer > View and checking that "Hidden Paragraph" is NOT checked. This will hide them in the master document and possibly the PDFs you export. If you need to see them again press Ctrl-F9 to hide/show the field codes.

I'm using v7.0.3 (Windows 10) but I am going to test in 6.4.7 to see ...(plus)

ben-demotic gravatar imageben-demotic ( 2021-01-11 17:58:01 +0100 )edit

I just edit the question and I have added the sample files. The writer file has the "Hidden paragraph" in the "Street 1" and the "City State Zip" lines.

It is necessary to register the list file as a DB, and connect it to the writer file (but you already know that :-))

Thanks!

FAtristain gravatar imageFAtristain ( 2021-01-13 20:55:58 +0100 )edit

@FAtristain: works for me, but not in your .odt sample file. This would require to update the "database" name part in all the fields, i.e. replace Addresses by the effective name of the Calc file. I hadn't the courage to create the correct data source and change all fields.

I used a built-in business letter template where I plugged some of your address book fields + the hidden paragraph field and it worked like a charm.

So my advice is to check for consistency between field designation and spreadsheet file name.

Report back if this is not the correct lead.

ajlittoz gravatar imageajlittoz ( 2021-01-14 11:39:11 +0100 )edit