Highlighted

Data Merge Multiple Entries in Single Text Box

New Here ,
May 20, 2020

Copy link to clipboard

Copied

Is there a quick and easy way to set up the data merge so in will insert multiple entries into a single text box? As an example, a phone directory is set up in an Excel file with different fields for name, phone and address. I want to merge the entries with particular formatting (bold for the name, italics for the address, etc.) and also want all of the entries in a single text box that I can flow from one page to another. I am trying to avoid linking the text boxes are copying and pasting after the merge as there are many entries and would be rather time consuming.

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi timw63166087,

there is no option in the user interface for this kind of work.

However it can be done by script.

 

Do your data merge with a template that has one single text frame holding the data merge fields.

Do a data merge so that for every result is one single page.

 

Run the ExtendScript ( JavaScript ) code below that will thread all text frames to one story.

Then select all text in that story and copy it over to your target text frame.

 

Prerequisites for the script:

[1] Active InDesign document.

[2] Exactly one text frame on every page.

 

var doc = app.documents[0];
var numPages = doc.pages.length;

for( var n=0; n<numPages-1; n++ )
{
	doc.pages[n].textFrames[0].nextTextFrame =
	doc.pages[n+1].textFrames[0];
};

 

Regards,
Uwe Laubender

( ACP )

 

 

TOPICS
How to

Views

169

Likes

Translate

Translate

Report

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

Data Merge Multiple Entries in Single Text Box

New Here ,
May 20, 2020

Copy link to clipboard

Copied

Is there a quick and easy way to set up the data merge so in will insert multiple entries into a single text box? As an example, a phone directory is set up in an Excel file with different fields for name, phone and address. I want to merge the entries with particular formatting (bold for the name, italics for the address, etc.) and also want all of the entries in a single text box that I can flow from one page to another. I am trying to avoid linking the text boxes are copying and pasting after the merge as there are many entries and would be rather time consuming.

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi timw63166087,

there is no option in the user interface for this kind of work.

However it can be done by script.

 

Do your data merge with a template that has one single text frame holding the data merge fields.

Do a data merge so that for every result is one single page.

 

Run the ExtendScript ( JavaScript ) code below that will thread all text frames to one story.

Then select all text in that story and copy it over to your target text frame.

 

Prerequisites for the script:

[1] Active InDesign document.

[2] Exactly one text frame on every page.

 

var doc = app.documents[0];
var numPages = doc.pages.length;

for( var n=0; n<numPages-1; n++ )
{
	doc.pages[n].textFrames[0].nextTextFrame =
	doc.pages[n+1].textFrames[0];
};

 

Regards,
Uwe Laubender

( ACP )

 

 

TOPICS
How to

Views

170

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 20, 2020 0
Adobe Community Professional ,
May 20, 2020

Copy link to clipboard

Copied

Hi timw63166087,

there is no option in the user interface for this kind of work.

However it can be done by script.

 

Do your data merge with a template that has one single text frame holding the data merge fields.

Do a data merge so that for every result is one single page.

 

Run the ExtendScript ( JavaScript ) code below that will thread all text frames to one story.

Then select all text in that story and copy it over to your target text frame.

 

Prerequisites for the script:

[1] Active InDesign document.

[2] Exactly one text frame on every page.

 

var doc = app.documents[0];
var numPages = doc.pages.length;

for( var n=0; n<numPages-1; n++ )
{
	doc.pages[n].textFrames[0].nextTextFrame =
	doc.pages[n+1].textFrames[0];
};

 

Regards,
Uwe Laubender

( ACP )

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 20, 2020 0