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

DataMerge DataSource from String

New Here ,
Sep 06, 2023 Sep 06, 2023

Copy link to clipboard

Copied

Hello,

is it some how possible to use data merge in a script without needing to select an external csv file as the data source?

I would like to extract the fields from a JSON payload and do the data merge within InDesign.

Or is there a way to "skip the selectDataSource-part" and replace the placeholders manually via script?

 

I hope that I have been able to express myself clearly.

 

Thanks in advance.

Regards

Lars

TOPICS
Scripting

Views

117

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
community guidelines
Contributor ,
Sep 06, 2023 Sep 06, 2023

Copy link to clipboard

Copied

 

I suggest:
- convert the file from json format to xml format.
- place xml tags in your indesign document
- keep the xml file name unchanged and update the link in indesign

Votes

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
community guidelines
People's Champ ,
Sep 06, 2023 Sep 06, 2023

Copy link to clipboard

Copied

LATEST

Almost everything is feasible. But I don't think you can create Datamerge Placeholders without loading a CSV file first. Besides the DataMergeFields collection doesn't expose an "add" method, which second that point.

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

 

That said, whatever, you will use Datamerge or XML import in a scripted way, it will probably start by manually tagging elements in the layout. Unless you have some deep logic to turn untagged contents to tagged contents. 

 

Loic

 

Votes

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
community guidelines