Bug 164287 - LibreOffice Writer's mail merge function does not work correctly.
Summary: LibreOffice Writer's mail merge function does not work correctly.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.2 all versions
Hardware: All All
: high normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2024-12-11 16:12 UTC by laurentlepoittevin
Modified: 2025-10-27 07:16 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
the test writer file (15.28 KB, application/vnd.oasis.opendocument.text)
2024-12-11 16:14 UTC, laurentlepoittevin
Details
simple calc file (16.82 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-12-11 16:14 UTC, laurentlepoittevin
Details
the result of saving a merged file with the exclusion of recipient 3 (1, 2 and 4 expected) (15.16 KB, application/vnd.oasis.opendocument.text)
2024-12-11 16:16 UTC, laurentlepoittevin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description laurentlepoittevin 2024-12-11 16:12:22 UTC
Description:
LibreOffice Writer's mail merge function does not work correctly.
This applies to both versions 24.8.3 and 28.4.1.
In 24.8.3, this leads to a crash and the closing of LibreOffice, in 28.4.1 it leads to the deletion of recipients located after the one to be excluded.
on 4 recipients, if 3 is excluded, on exit I get a document with recipient 1, then one with recipient 2, and a final document with recipient 2 again. No recipient 3, which is normal, but no recipient 4, which is not normal.

Steps to Reproduce:
1 . open the file publipostage.odt
2 . if necessary, link the mailing to publipostage.ods
3. exclude recipient 3 (record 3)
4. save merged documents 
5. choose whether you want a single document or several (it doesn't work in both cases)
6. with version 24.8.3 Libreoffice closes, with version 24.8.4.1 the documents are saved but record four is missing.

Actual Results:
with version 24.8.3 Libreoffice closes, with version 24.8.4.1 the documents are saved but record four is missing.

Expected Results:
if I choose the single merged document function, I obtain one document with the three recipients (1, 2 and 4), if I choose the single document function, I obtain three documents, one for recipients 1, 2 and 4. Recipient 3 is excluded.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Please note that the record number in the navigation interface does not change when moving from one record to another.
Comment 1 laurentlepoittevin 2024-12-11 16:14:04 UTC
Created attachment 198065 [details]
the test writer file

the simple writer file I used to test the mailing function
Comment 2 laurentlepoittevin 2024-12-11 16:14:56 UTC
Created attachment 198066 [details]
simple calc file

the simple calc file I used to test the mailing function
Comment 3 laurentlepoittevin 2024-12-11 16:16:01 UTC
Created attachment 198067 [details]
the result of saving a merged file with the exclusion of recipient 3 (1, 2 and 4 expected)

the result of saving a merged file with the exclusion of recipient 3 (1, 2 and 4 expected)
Comment 4 laurentlepoittevin 2024-12-11 16:21:20 UTC
(In reply to laurentlepoittevin from comment #0)
> Description : La fonction de fusion de courrier de LibreOffice Writer ne
> fonctionne pas correctement. Cela s'applique aux trois versions 24.2.7, 24.8.3 et
> 28.4.1.En 24.2.7, cela conduit à un crash et à la fermeture de LibreOffice,
> en 24.8.3 et 28.4.1 cela conduit à la suppression des destinataires situés après celui
> à exclure. Sur 4 destinataires, si 3 est exclu, à la sortie j'obtiens un
> document avec destinataire 1, puis un avec destinataire 2, et un document
> final avec destinataire 2 à nouveau. Pas de destinataire 3, ce qui est
> normal, mais pas de destinataire 4, ce qui n'est pas normal.Etapes pour
> Reproduire :1 . ouvrir le fichier publipostage.odt2 . si nécessaire, lier
> l'envoi à publipostage.ods3. exclure le destinataire 3 (enregistrement 3) 4.
> enregistrer les documents fusionnés 5. choisir si vous voulez un seul
> document ou plusieurs (cela ne fonctionne pas dans les deux cas) 6. avec la
> version 24.8.3 Libreoffice ferme, avec la version 24.8.4.1 les documents
> sont sauvegardés mais l'enregistrement quatre est manquant Résultats Réels :
> avec la version 24.8.3 Libreoffice ferme, avec la version 24.8.4.1 les
> documents sont sauvegardés mais l'enregistrement quatre est manquant
> Résultats attendus : si je choisis la fonction unique document fusionné,
> j'obtiens un document avec les trois destinataires (1, 2 et 4), si je
> choisis la fonction document unique, j'obtiens trois documents, un pour les
> destinataires 1, 2 et 4. Le destinataire 3 est exclu.Reproductible :
> ToujoursRéinitialiser le profil de l'utilisateur : OuiInfo supplémentaire :
> Veuillez noter que le numéro d'enregistrement dans l'interface de navigation
> ne change pas lorsque vous passez d'un enregistrement à un autre.
Comment 5 laurentlepoittevin 2024-12-11 16:39:32 UTC
in version 25.2.0, LibreOffice crashes completely with no document output
Comment 6 BogdanB 2024-12-21 16:48:24 UTC
Confirm with
Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Also with
Version: 7.2.3.2 / LibreOffice Community
Build ID: d166454616c1632304285822f9c83ce2e660fd92
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 7 Dieter 2025-05-05 19:14:46 UTC
*** Bug 158517 has been marked as a duplicate of this bug. ***
Comment 8 Dieter 2025-05-05 19:16:51 UTC
Regarded to the duplicate bug 158517 comment 15:

The bug is also present with the new version:
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
Comment 9 laurentlepoittevin 2025-05-07 08:02:12 UTC
The bug is also present with the version Version: 25.2.3.2 (X86_64) / LibreOffice Community
with the same documents as those supplied, out of the four elements in the database, if I exclude the second, I have 1 and 3 as output, so the last element (4) is missing.
if I don't exclude any elements, I get all four as expected.
Comment 10 claudio 2025-06-21 06:19:36 UTC
This report (Bug 164287 ) is a duplicate of bug 158517, as evidenced by both the date and sequence number of the bug.
I request that the status of bug 164287 be changed from new to duplicate, and that the status ‘New’ be assigned to bug 158517.
Comment 11 laurentlepoittevin 2025-10-07 08:31:18 UTC
The bug is still present in version 25.8.1.1.
When exporting with exclusions, only the data before the first exclusion is actually exported to a single document. If you choose one file per record, you get the correct number of files (one per record) but not the correct data. In the case of the files in the example provided, if I remove record 2, I get record 1 and two copies of record 3, but not record 4.
Comment 12 laurentlepoittevin 2025-10-07 08:36:41 UTC
If it will reassure some people and resolve the issue as quickly as possible, you can delete this bug report and I will continue to report it in No. 158517. The most important thing for me is that it gets resolved. We are encountering quite a few problems in my administration due to this bug, and it is a real obstacle to the adoption of LibreOffice. Unfortunately, I don't have the skills to help you. And contrary to what I read in the other report, I'm not so sure it's that simple. In any case, thank you in advance.
Comment 13 Alex Thurgood 2025-10-21 08:59:23 UTC
Confirming also with

Version: 25.8.1.1 (AARCH64)
Build ID: 54047653041915e595ad4e45cccea684809c77b5
CPU threads: 8; OS: macOS 26.0.1; UI render: Skia/Metal; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 14 Alex Thurgood 2025-10-21 10:09:52 UTC
One observation I have is that when the Writer file is opened to commence the mailmerge, the count index of the number of records displays -1 for the first record. This is clearly incorrect.

When the user then clicks on the rightward arrow, that record number then changes to one, seemingly with the impossibility to move back down to record 1.

It would appear that the variable that sets the number of records is being incorrectly determined at the start, and that this might be what leads to the error in the production of the merged document.

Wondering whether it is something in:

core/sw/source/uibase/dbui/mailmergehelper.cxx
Comment 15 Alex Thurgood 2025-10-21 10:26:24 UTC
(In reply to Alex Thurgood from comment #14)

Maybe the following block of code ?

void SwAddressPreview::RemoveSelectedAddress()
{
    m_pImpl->aAddresses.erase(m_pImpl->aAddresses.begin() + m_pImpl->nSelectedAddress);
    if(m_pImpl->nSelectedAddress)
        --m_pImpl->nSelectedAddress;
    UpdateScrollBar();
    Invalidate();
}
Comment 16 Saburo 2025-10-22 01:21:04 UTC
add keyword notBibisectable

Exclude recipient is glayout (bug 143777)
repro
Version: 7.2.2.0.0+ / LibreOffice Community
Build ID: 7e54667cbfafac1ea806245475930fd2dcc6fe36
CPU threads: 2; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: en-US
Calc: threaded

no repro
Version: 7.1.7.0.0+ / LibreOffice Community
Build ID: 270f7e1e86542ad6d50a44e096e1e77a30a8d0d6
CPU threads: 2; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: en-US
Calc: threaded
Comment 17 Xisco Faulí 2025-10-24 19:00:23 UTC
After some time, I was able to bisect it manually.

Regression introduced by:

commit ec44f87d5b99a3299322d0b79abc4c6808877865	[log]
author	Balazs Varga <balazs.varga991@gmail.com>	Mon Mar 22 13:34:37 2021 +0100
committer	László Németh <nemeth@numbertext.org>	Wed Mar 31 12:24:22 2021 +0200
tree 684cd7e5306595fe406988c33874aaca569adc2c
parent 3db477fd0e6cfc4ff77b3c911ca4ab14fd980932 [diff]

tdf#117212 sw mailmerge: merge only the selected range