Retain leading zeros when printing calc numeric field as text

Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: c21113d003cd3efa8c53188764377a8272d9d6de
CPU threads: 4; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: CL threaded

A table created from a sheet with a column of 4 digit numbers with leading zeros (starts at 0001) loses the zeros when the mail merge takes place. How can I retain the leading zeros in the printer output?

It sounds like the zeros are coming from formatting in Calc. If that’s the case, then you could build a helper column in the source sheet that has the numbers as text, to make certain they will merge as formatted. If A2 has 0001 then insert a column for B with B2 as

=TEXT(A2, “0000”)

Copy that down then use that column in your merge, column B, not A.

Otherwise, you might post a sample of your source data sheet.

Thanks Joshua4 but I was hoping there might be a way to format the cells of the column as text without losing the zeros and without having to modify the structure of the table.

There would be ways with macros to copy the sheet to another sheet where the second sheet would have pure text, then you could use that sheet as your source for the mail merge. Another possibility would be to see if you can get the formatting to export to a CSV and use that CSV file as your mail merge source. Post if either of these interest you.

Assuming this »kind« of Numbers was|is never used for numeric Calculations I suggest converting them to Text:
→→Search and replace:
Search:

^.*$

[x]formatted Display
replace:

'&

[x]regular Expression
[x]only Selection
→→replace all

1 Like

I opted for your first suggestion and inserted a column.