Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Indesing data merge with plain text qr code

New Here ,
Apr 06, 2023 Apr 06, 2023

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

TOPICS
How to
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2023 Apr 06, 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2023 Apr 06, 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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2023 Apr 06, 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 13, 2023 Apr 13, 2023

 

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.)

 

 

And this is excaclty what I tried to do with the CHAR(10) or CHAR(13) formula. But it didn't work.

 

 

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.

 



How can I do that?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 13, 2023 Apr 13, 2023

The first suggestion means that perhaps the Excel formulas are not working correctly; you'd have to look at the actual export code to see if a pure, plain ASCII 10 or 13 is there, or if Excel is being "helpful" and exporting something more complex, that InDesign won't read correctly. I was able to enter just a code for each using Alt keys; there may be a simpler method including search and replace.

 

On the second, I can't say without seeing some kind of sample, but as any kind of return or break is optional (or even discouraged) in QR code fields, simply removing all of them from the Excel source would be one approach.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 13, 2023 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 13, 2023 Apr 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2025 Feb 24, 2025

\n solo funciona en vcard, no en texto plano. estoy batallando con eso.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2025 Feb 24, 2025

I thought we had pinned down a solution for field separation and message line breaks using the Plain Text method. Glancing through this thread and other notes, that may not be the case.

 

There are several different "line break" and "return" and so forth characters, as noted above. One starting point would be to experiment with each to see if the encoding process and then decoding recognizes them correctly.

 

Making note to experiment with this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2025 Feb 24, 2025

Have you tried using simple line returns in the actual text? As in —

 

Fred Jones

1234 Code Street

Nowhere CA 123454

USA

(123) 456-7890

 

This is working for me in test exports read with QR Droid, the default Android QR reader and a more technical Android-based reader. I am not sure what is being encoded to create the line break; I can't reach the online technical decoder at the moment.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 25, 2025 Feb 25, 2025

Las soluciones hasta ahora han abordado situaciones donde no se utiliza datamerge o cuando se utiliza vcard, allí valen todas las que han publicado. pero cuando se desea automatizar la generación de códigos QR con data merge en Indesign para texto plano, los saltos de línea son un dolor de cabeza. Para datamerge los datos se preparan en un archivo csv en la que el campo para el código QR tiene el encabezado de "#QR codes" o algo similar con "#" al inicio. al escribir texto plano con saltos de línea manual como ha mencionado en su anterior respuesta, simplemente no es leido por indesign, solo la primera línea antes del primer salto de línea manual es considerado al momento de crear el código QR. he intentando con \n para mantener solo una línea única de texto en el archivo csv, esperando que al crear el código QR sea reconocido como saltos de línea, pero no es posible. he intentado con otros marcadores como \r para insertar los saltos de línea pero nada hasta ahora ha funcionado. no se si soy el primero que le ha sucedido pero no he encontrado hasta ahora una solución al respecto. me parece que el problema está en cómo indesign interpreta los datos proveidos mediante un archivo csv, ya que si recurro a generadores de QR externos, el problema parece ser insignificante. uso Windows 10 y la última versión de Indesign al día de hoy 25/02/2025.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

It's not clear from your description if you're doing this, but have you tried inserting the breaks as a separate merge field? That would allow experimentation with different break code options.

 

I am not completely sure the \r and \n codes are interpreted correctly or fully by the QR code generator. I only know of one good "analytical" code reader, ZXing, and its site is down. You might look for an alternate host or (if you're able) work from the Git source for this reader, which can be used to spell out every character in a QR code string, without interpreting things like line returns and such.

 

I don't know what the difference could be in the code creators — I would suspect none. That leaves the way ID's data merge handles the process as the hurdle to be gotten over.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

Useful trick, but not sure it would work in this case since what's generated is not text but the QR code, which as we've found is highly resistant to things like F/R changes.

 

I am deeply frustrated. Of all the code readers and such out there, I had found one (1) that had a completely raw data dump mode, very useful for investigation and troubleshooting. The site has gone dark, and the Java code has been abandoned after some 12-13 years. We really, really could use such a diagnostic tool but my coding skills based on sticks and small pebbles aren't up to taking the code (ZXing) and doing much with it.

 

That QR codes are so wholly pwned by the shady-to-marketing-to-malware end of things is... annoying.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

@James Gifford—NitroPress I will confess to being totally ignorant of things outside the realm of print, but if this is a "plain text" QR code and it's text in the .csv file, how could editing the text before exporting to final output be a problem? Does InDesign read the field header and "know" this is a QR code and automatically build the graphic on import?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2025 Feb 25, 2025

@Peter Spier

 

Yes, but the problem is in the fact, that if you export CSV file with extra line breaks - DataMerge isn't flexible / smart enough to ignore those - and recognise true "end of record" enters. 

 

"#" before the field name indicates QR code data.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

But at what point does the code get generated? Seems to me you ought to be able to use a placeholder character and replace it withthe "correct" break character (copy one to clipboard, maybe?) if the code is mutable until output.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2025 Feb 25, 2025

@Peter Spier 

 

QR code is build when you execute DataMerge - data is read from the CSV file - and QR code is created dynamically - the same way as when you want InDesign to import image - there is no "itermediate" state where text exists - in InDesign - and you can modify this text.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2025 Feb 26, 2025
LATEST

OK, that answers that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

This thread has two facets, and I will confess that anything beyond fairly simple data merge operations are beyond my experience.  But AFAIK a CSV operation to create a QR code does so more or less directly/internally; I am not sure there's any intermediate data storage or structure that can be accessed and changed, using F/R or anything else. Maybe.

 

My focus and interest is in getting an *exact* data dump of what's encoded, not something that substitutes things like line return or line break with an equivalent character or code, or turns such characters into a displayed line break. It's not enough to say "there's a line break in the data at that point"; to do advanced work with the data and encoding, we need to be able to inspect and find out exactly what glyph/code is there, in the QR string. And the one tool that told that tale is... out of print, more or less.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2025 Feb 25, 2025

@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":

 

RobertatIDTasker_2-1740512293743.png

 

RobertatIDTasker_0-1740512182580.png

 

RobertatIDTasker_1-1740512199696.png

 

 

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

It would be nice to know, for certain, exactly what glyph/code is being used as the line break/return in the code itself. But both the editing/encoding process and the read process (for 99.999% of readers) mask that detail. See above rant. 😛

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2025 Feb 25, 2025

@James Gifford—NitroPress 

 

You mean this?

RobertatIDTasker_0-1740515096848.png

 

Typed as - "aaa"+Enter+"bbb"+Shift&Enter+"ccc"

 

But it looks like the second one - forced/soft / Shift+Enter - has been converted to hard anyway?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2025 Feb 25, 2025

Exposing the actual code in the code, as it were, instead of "interpreting" it into a readable display. You have that for the ID side, but it would be preferable to read it back from actual codes for that last lick of accurate representation. I dislike processes that mask key elements, even if in the name of convenience.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines