0



I am creating a new InDesign document with  var newDoc = app.documents.add() .

I am trying to place another pre-existing InDesign document that has paragraph styles into the new document. The reason why I'm not simply using  styledDocument.execute()  is that it opens this pre-existing document, whereas I want the document itself to be "Untitled".

I am attempting to do this with  newDoc.place(styledDocument) , which is not working. The document is untitled as intended, but has the styled document as a link only, and is not populating the  Paragrah Styles  window with the styles from the styled document...


It is possible from  File --> Place...  in the InDesign menu to open another InDesign document into this one manually, in which the styles from this document do appear in the  Paragrah Styles  window... But I want to programmatically do this. So, I am assuming that  File --> Place...  from the InDesign menu is different than  newDoc.place(oldDoc).


Here is my code (which is not working):
var newDoc = app.documents.add();
newDoc.place(styledDocument);


Ian Campbell
  • 2,678
  • 10
  • 56
  • 104

1 Answers1

1

Wawawaaa, what is your final intention ? Load styles from doc A into Doc B ? If that so, why not use the document's importStyles method ? If you do want to import document as an image, you can use the place method and specify the document as any other image file.

Loic
  • 2,173
  • 10
  • 13
  • Haha ok, I was confusing myself with this question. Yes, importing styles from doc A into doc B is exactly what I want to do. And looking into the `importStyles` method, I am making this statement: `myDocument.importStyles(ImportFormat.paragraphStylesFormat, File(styledDocument), GlobalClashResolutionStrategy.loadAllWithOverwrite);`. Thanks for the help Loic. – Ian Campbell Jul 20 '12 at 19:23
  • I have found information at jongware on this method here: http://jongware.mit.edu/idcs6js/pc_Document.html. But for more specific information, http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDesignCS5_ScriptingGuide_JS.pdf has a great code sample implementing this. – Ian Campbell Jul 20 '12 at 19:26