Skip to main content
New Participant
April 6, 2023
Question

Indesing data merge with plain text qr code

  • April 6, 2023
  • 3 replies
  • 2699 views

Hello everyone,
I have to create a data merge document including a plain text qrcode.
My source is a CSV file from libreoffice.
The trouble comes when I try to insert a line feed or a carriage return.
Using excel formula CHAR(10) or CHAR(13) does not work, because the rendering return just the first line of the text.
Is there a way to fix the issue?
Thanks

3 replies

New Participant
November 2, 2025

How can i fit it

 

Braniac
April 13, 2023

Here is what I have used for datamerge and plain text QR codes. \n is used to separate lines of a vcard.

N:Smith;John\nFN:John Smith\nORG:Company\nTITLE:Engineer\nTEL;CELL:+1234567890

James Gifford—NitroPress
Braniac
April 13, 2023

That should work, and it should be possible to include '\n' fields in the Excel data. OTOH, any kind of export of control or escape characters can be exasperating. 🙂

 

I may have misunderstood the OP. If the problem is to separate the vCard fields, this solution should work. If the issue is trying to put line breaks in long text fields... this may or may not work as intended.

 

Robert at ID-Tasker
Braniac
February 25, 2025

Different situation but similar, I thnink, was when I was doing directory work using data merge. Some descriptive fields needed multiple paragraphsand in those cases I used either a \n or other character combination not normally in use in the Excel file which then exported as those plain text characters. After the merge I ran Find/Change to replace the character combination with the actual break.


@Peter Spier 

 

Unfortunately, It won't work for QR codes - because you can't do F/C in the contents of already generated code - more info below.

 

@Oscar37348334mhvc 

 

If you want to have soft/hard breaks in the QR code - you can't do this with DataMerge - because DataMerge can't read files like that - soft/hard enter means "end of the dataline":

 

 

 

 

 

You need a 3rd party tool - replacement for the DataMerge - that will either be able to read your CSV file or take your multiline value for the QR code - convert temporary replacements of the soft/hard breaks - and use this String when generating the code.

 

 

Or a simple script, that will convert specific texts - after importing them as a plain text (with hard/soft enters replaced with some unique tags) during DataMerge - and convert those texts into a QR code (replacing on the fly those unique tags into soft/hard returns) - do post-processing on your DataMerged file:

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Rectangle.html#d1e218082__d1e220701

 

James Gifford—NitroPress
Braniac
April 6, 2023

Most QR code guidelines say to simply use a line return or paragraph character; most code readers respect them for multi-line display. (Some do not, though.) Check the text that is actually being passed to the QR code field. It must be an actual ASCII 10 or 13 character, not the Excel code string or anything like it.

 

You may find some or all of this helpful: https://nitrosyncretic.com/DPR/dpr_qrcodes.php.

 

New Participant
April 6, 2023

I know but I have to do a data merge, so the text comes from excel, and even though I see the text in excel properly edited and rendered,  the final qrcode output shows just the first line in indesign (and into any qr code reader).

James Gifford—NitroPress
Braniac
April 6, 2023

Obviously ID is reading that Excel code as an "end of record" mark.

 

Try entering an ASCII code/character instead. Excel lets me type in both Alt-10 and Alt-13, and that character may be recognized as a return/line end in the merge. (ETA: I am not sure of the exact format InDesign is reading; you might try alternate codes such as /r and /n, or the HTML code %0D.)

 

The only other solution I can think of is to remove all such return characters and let the reader do the text wrapping in each field.