Jump to content

Line breaks in merge data


Recommended Posts

I haven't been able to find an answer for this. In version 1, I could create a CSV file with line breaks to print envelopes with Affinity Publisher (fly, meet sledgehammer).

In version 2, or maybe with an option flipped, the merge data follows word wrapping. Instead of three lines in the address, I get one, word-wrapped inside the text box as if the merge data didn't include line breaks.

Is there an option to change how line breaks are processed in merge data?

Many thanks in advance.

Link to comment
Share on other sites

There is something odd going on here, in both Publisher and Publisher 2, so I suspect they fixed a V1 bug in V2, but maybe the fix broke something else.

Here's a screenshot of a record preview from V1. Note that in the Fields panel we see that the record has a multi-line Address field. Yet in the document page, we see only the first line. That seems wrong, to me.
image.png.8303b0e20133a9829541bf6248a706e5.png

Here's the same preview but in V2. Note that we see all 3 lines of the address. However, we see paragraph breaks between the lines, not line feeds:

image.png.516569126068fd9841950d1f3d669e81.png

So, we now see the complete preview in V2, so that's one bug fixed. But what should have been line breaks in the preview are paragraph breaks. That seems like a bug.

And what is finally generated when we run the Merge is this, which has neither the expected line breaks nor paragraph breaks:

image.png.e4b9dd73af0eca83443b832d1a78c1ae.png

Note that it also lost the comma after Anywhere. (Yes, I know this is a CSV file, but the multi-line address field is quoted (" surrounding it) which should "escape" the comma, and we can see in the preview and in the Fields panel that it did.)

So that's another bug.

Here's the CSV file, for others who want to work with this: Untitled 1.csv

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

Multilines fields in csv file is a big subject…

Generally, in csv files, CR LF is used for end of line… Comma is the field separator… "" are used to delimit fields… and so there is confusion when it comes to multiline fields…

To deal with those multilines fields, Filemaker, for example, use the VT code ( = 0B = vertical tabulation)…

I feel your document Untitled 1.csv is strangely built, data isn't displayed in columns… like a classical csv file…

You have a 0D 0A (hex) after Address, 0D 0A (hex) after Address2, 0A after ["My street],  0A after [Apt 23], and 0D 0A after [Anywhere, USA"].

Where 0A = LF = line feed ; 0D 0A = CR LF = carriage return + line feed.

Because you have only one record in your file I don't know what code you would use as a line separator ? LF and CR are already used inside the record itself…

Here is the csv file with comma separated values, LF for multiline field, and CR LF as end of line :

Untitled2.csv

Note : CR LF as end of line is generally on Windows system ; LF as end of line is generally on macOS system (or Unix).

Concerning Affinity, I wonder what code is used to work with multiline fields ? LF (could be a problem for Mac files) ? VT ? Other ?

I also wonder if "" are used as field delimiters because there's the problem with the comma that disappeared as Walt noted…

MacBook Pro 16 pouces (3456 × 2234), 2021 / Apple M1 Pro / 16 Go / macOS Ventura Version 13.4.1 (22F82)
+ 31,5 pouces (2560 × 1440) + 27 pouces (1080 × 1920) + iPad (8th generation) / iPadOS 17.2 + Apple Pencil + 

Macmini6,2 Quad-Core Intel Core i7 16 Go / macOS Catalina version 10.15.7 (19H2026)
MacBookAir6,2 Intel Core i5 double cœur 4 Go / macOS Big Sur version 11.7.7 (20G1345)

Licence Universelle Affinity V2 updated to 2.3.0

Link to comment
Share on other sites

1 hour ago, laurent32 said:

I feel your document Untitled 1.csv is strangely built, data isn't displayed in columns… like a classical csv file…

It has only 1 column. Thanks for pointing out the 0D/0A issue. I had missed that.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

2 hours ago, walt.farrell said:

It has only 1 column

I think it should be one row ?

MacBook Pro 16 pouces (3456 × 2234), 2021 / Apple M1 Pro / 16 Go / macOS Ventura Version 13.4.1 (22F82)
+ 31,5 pouces (2560 × 1440) + 27 pouces (1080 × 1920) + iPad (8th generation) / iPadOS 17.2 + Apple Pencil + 

Macmini6,2 Quad-Core Intel Core i7 16 Go / macOS Catalina version 10.15.7 (19H2026)
MacBookAir6,2 Intel Core i5 double cœur 4 Go / macOS Big Sur version 11.7.7 (20G1345)

Licence Universelle Affinity V2 updated to 2.3.0

Link to comment
Share on other sites

1 hour ago, laurent32 said:

I think it should be one row ?

I think it has 2 rows, one column each. But that might have been an earlier version.

My point was that the data is displayed in columns, but there's only one of them.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

  • 4 months later...

Serif have not updated either of the topics that has a bug tag for this to mark them as fixed, so it probably isn't: 

https://forum.affinity.serif.com/index.php?/search/&tags=AFB-7327

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

This has not been fixed, but there is a reasonably easy workaround.

Open your csv file in a spreadsheet app. Replace every occurrence of newline with something recognizable. I like ¶.

Merge the data into Affinity. In Affinity, replace every occurrence of ¶ with newline. Note that in the Affinity replace field, newlines appear as ¶ characters. No biggie, it works.

For more of a one-click-fix for the csv file, use BBEdit on Mac with a saved text factory (like a macro) to make the change.

On either Windows or Mac, the extremely wonderful Easy Data Transform can save transformations. Load a csv file, apply the pilcrow transform, and save it.

I don't have anything to do with Easy Data Transform. If you do much with merge data you may find it a good companion for other reasons.

For instance, say you've got customer data including name and address in an Excel file, a csv export from your accounting system showing a log of individual sales, and a JSON dump from a tracking system that relates customers to industrial categorizations. EDT can do joins across different source formats. You could extract the customers from the Excel file with sales totals in the csv file beyond some threshold that appear in targeted industries in the JSON dump, writing your distilled data to csv (or any of several formats).

Good luck with your merges!

Edited by Amontillado
Forgot a detail.
Link to comment
Share on other sites

3 hours ago, Amontillado said:

This has not been fixed, but there is a reasonably easy workaround.

Open your csv file in a spreadsheet app. Replace every occurrence of newline with something recognizable. I like ¶.

Merge the data into Affinity. In Affinity, replace every occurrence of ¶ with newline. Note that in the Affinity replace field, newlines appear as ¶ characters. No biggie, it works.

For more of a one-click-fix for the csv file, use BBEdit on Mac with a saved text factory (like a macro) to make the change.

On either Windows or Mac, the extremely wonderful Easy Data Transform can save transformations. Load a csv file, apply the pilcrow transform, and save it.

I don't have anything to do with Easy Data Transform. If you do much with merge data you may find it a good companion for other reasons.

For instance, say you've got customer data including name and address in an Excel file, a csv export from your accounting system showing a log of individual sales, and a JSON dump from a tracking system that relates customers to industrial categorizations. EDT can do joins across different source formats. You could extract the customers from the Excel file with sales totals in the csv file beyond some threshold that appear in targeted industries in the JSON dump, writing your distilled data to csv (or any of several formats).

Good luck with your merges!

Nice hint. Haven't thought about replacing placeholders afterwords. Makes it a little annoying to use but would be a valid solution indeed.

Thanks for the idea! 👍

Affinity User on Windows 11

Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...

Thanks for letting us know @affineuser & apologies for the delayed response over the holidays.

On 12/18/2023 at 1:46 PM, affineuser said:

Has Serif some sort of upvoting a feature request or bug?

I can confirm that I have 'bumped' this issue with our development team using your report, to bring it to their attention once again.

I hope this helps :)

Link to comment
Share on other sites

  • 4 weeks later...
On 1/2/2024 at 10:29 AM, Dan C said:

[…] I can confirm that I have 'bumped' this issue with our development team using your report, to bring it to their attention once again. […]

Highly appreciated, thank you very much! While at it, maybe you can also have a look at this issue. I have an excel file with a date column and a text column

image.png.867575288463c0a64fdffeed8e113824.png

A4 is the value of "04.03.2024", displayed as custom date format TTTT, T. MMMM JJJJ

image.png.90eb9763a206cb6a3135ed0a878dddf8.png

B4 is the formula =TEXT(A4;"TTTT T. MMMM JJJJ")

In my Publisher 2 document, I put in both place holders

image.png.d7816a41a901266b82603b3d40cf741e.png

The two columns behave differently. For the first one, there is a "/" character instead of the "." character.
The second column is displayed correctly.

image.png.f26cf7f2486d57d7c0076b49b1cd2d8e.png

image.png.7133d30e7c2dbd3bebeaaff23459aaef.png

It's a German excel version of Office 365.

Edited by PublicBenemy
Link to comment
Share on other sites

1 hour ago, PublicBenemy said:

While at it, maybe you can also have a look at this issue. I have an excel file with a date column and a text column

Hallo und willkommen im Forum.

Kannst Du uns bitte die Excel-Datei bereitstellen, damit wir schauen können, wo der Fehler sein kann?  

MAC mini M4 | MacOS Sequoia 15.1.1 | 16 GB RAM | 256 GB SSD 
AMD Ryzen 7 5700X | INTEL Arc A770 LE 16 GB  | 32 GB DDR4 3200MHz | Windows 11 Pro 24H2 (26100.2161)

Affinity Suite V 2.5.6 & Beta 2.6 (latest)
Interested in a free (selfhosted) PDF Solution? Have a look at Stirling PDF

Ferengi Acquisition Rule No. 49: “A deal is a deal is a deal.”

Link to comment
Share on other sites

42 minutes ago, PublicBenemy said:

ich hoffe, es klappt.

Hat funktioniert. Es ist der Punkt, der von Publisher falsch ausgelesen wird. Warum auch immer.

Nutze als alternatives Zellenformat nachfolgende Formatierunsvorlage

[$-de-DE]TTTT T. MMMM JJJJ

 

@Dan C FYI It is the full stop that Publisher reads incorrectly from the Excel spreadsheet.

 

MAC mini M4 | MacOS Sequoia 15.1.1 | 16 GB RAM | 256 GB SSD 
AMD Ryzen 7 5700X | INTEL Arc A770 LE 16 GB  | 32 GB DDR4 3200MHz | Windows 11 Pro 24H2 (26100.2161)

Affinity Suite V 2.5.6 & Beta 2.6 (latest)
Interested in a free (selfhosted) PDF Solution? Have a look at Stirling PDF

Ferengi Acquisition Rule No. 49: “A deal is a deal is a deal.”

Link to comment
Share on other sites

  • 5 months later...
42 minutes ago, mondze said:

Update:
Have the same issue, Publisher 2.5.3 no breaks implanted

As the Affinity Info Bot has not posted to say the issue is fixed, that's not surprising.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

  • 1 month later...

Just want to confirm our deep need for this feature. It did not occur to me that newlines would not be handled well... I should've tested, but we've now got packaging labels designed in Publisher 2 and there are a lot of line breaks we need to deal with. The find/replace of a special character, seems to work, but boy does it make me nervous, and adds a step which can lead to error.

Link to comment
Share on other sites

  • 1 month later...
  • Staff
On 10/1/2024 at 1:18 PM, Mahlon Stacy said:

I need this fixed, too. I have a 36 page program that has many merged entries with line breaks.

Hi Mahlon Stacy welcome to the forums,

This is something that is still being looked into by our dev team it should be fixed in one of our future updates, I apologise for any inconvenience in the meantime.

Thanks
C

Please tag me using @ in your reply so I can be sure to respond ASAP.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.