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

how to render an image from excel through script!

Participant ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hey everyone! 

 

I'm wondering are there any way to render a column of images from excel sheet to indesign using script? 

 

because i managed to read the column but once i do this line of code downbelow, appers to me an alert message telling me this:

Error: Cannot create the link resource from the given URI.

 

 

doc.textFrames[counterFrame].place(tempArr2[k])

 

also, to make sure that the system reads the links proprly i've printed each uri in the specified textframe, and it works good! and  i've extracted the uri from the terminal so i'm pretty sure it's valid.

 

doc.textFrames[counterFrame].contents= tempArr2[k]

 

 

so,  the proplem rase when i use the place method. any one nows how can i slove it? 

 

i'm using javascript.

TOPICS
Activation billing and install , Bug , Feature request , How to , Import and export , InCopy workflow , Performance , Print , Publish online , Scripting , SDK , Sync and storage , Type

Views

255

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

correct answers 1 Correct answer

Community Expert , Jul 27, 2020 Jul 27, 2020

Hi Brian,

 

We can place image into a textframe it is automatically converted into rectangle, so that should not be an issue.

salshaw749 Can you try the following

if(doc.textFrames[counterFrame].isValid == true)
  doc.textFrames[counterFrame].place(File(tempArr2[k]))
else
  alert("The frame is invalid")

 

-Manan

 

 

Votes

Translate

Translate
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

You need to place an image into a Rectangle or other graphics frame. A text frame can't accept it. 

var rect = doc.rectangles.add();

rect.place(temp2Arr[k]);

rect.fit();

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
Participant ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hey, thanks for replaying. I've changed as you said and still get the same alert.

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
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hi Brian,

 

We can place image into a textframe it is automatically converted into rectangle, so that should not be an issue.

salshaw749 Can you try the following

if(doc.textFrames[counterFrame].isValid == true)
  doc.textFrames[counterFrame].place(File(tempArr2[k]))
else
  alert("The frame is invalid")

 

-Manan

 

 

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
Participant ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Thanks Manan! That's works! 

I've tried to use rectangle insted for the purposes of the project. anyhow, I want to place more than one picture in the same rectangur but it only catch the last one in the array and ignore the others, do you know why? this is the code i'm using.

		for(var k =0; k<=tempArr2.length-1;k++){

			if(doc.rectangles[counterFrame].isValid == true){
				doc.rectangles[counterFrame].place(File(tempArr2[k]))
			
				doc.rectangles[counterFrame].fit(FitOptions.CONTENT_TO_FRAME)
				doc.rectangles[counterFrame].select(SelectionOptions.ADD_TO)
		
				}
			else{
 			 	alert("The frame is invalid")
				  }
			
		}

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
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

This is how InDesign works you can't host more than one image in a frame, so the behaviour is correct. You can try doing the same using UI and will see its not possible. So the option that you have is to create new frames for each image and size/position them as needed.

 

-Manan

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
Participant ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

LATEST

Thanks Manan, for sharing the knowledge!

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