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

DataMerge DataSource from String

New Here ,
Sep 06, 2023 Sep 06, 2023

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

 

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

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

 

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