Skip to main content
alexanderk57613459
Participating Frequently
February 3, 2017
Answered

Place all Microsoft Word pages in the .indd document

  • February 3, 2017
  • 1 reply
  • 1702 views

Hello.

I need to place all word's document pages into one indd document.

For now the following code placing only the first page:

var myDocument = app.documents.add();

myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

var myX = myDocument.pages.item(0).marginPreferences.left;

var myY = myDocument.pages.item(0).marginPreferences.top;

myDocument.pages.add();

var myStory = myDocument.pages[0].place(File("C:/js/klb.doc"),[myX, myY],undefined,false,true);

var pcount = myStory.length;

//var myPDFExportPreset = app.pdfExportPresets.item("prepress");

myDocument.exportFile(ExportFormat.pdfType,File("C:/js/HelloWorld.pdf"));

app.documents.item(0).close();

place() method returns an array with only one item - so i can not iteraqte over the pages.

Could you please give an advice how to map each .doc page into separate .indd page?

Thanks.

-Alex.

This topic has been closed for replies.
Correct answer Laubender

Hi Alex,

are you sure that the story of the text frame that is created is only holding one page of the Word document?
Did you check for overset text? It's not clear how your InDesign's preferences for automatic text flow are set.

If there is more text in the story that the text frame can actually hold, you have to add text frames to the story.

Also see the problem for recomposing text by working with a loop for adding text frames while a story overflows.

You can find some discussions about that here in the forum. Also important: Your InDesign version.

FWIW:

You cannot map the pages of a Word doc exactly to pages of InDesign without having page break special characters in your word file that indicate where to break.

You can manage the import a bit by setting inDesign's

app.wordRTFImportPreferences

See especially property convertPageBreaks

Regards,
Uwe

1 reply

LaubenderCommunity ExpertCorrect answer
Community Expert
February 3, 2017

Hi Alex,

are you sure that the story of the text frame that is created is only holding one page of the Word document?
Did you check for overset text? It's not clear how your InDesign's preferences for automatic text flow are set.

If there is more text in the story that the text frame can actually hold, you have to add text frames to the story.

Also see the problem for recomposing text by working with a loop for adding text frames while a story overflows.

You can find some discussions about that here in the forum. Also important: Your InDesign version.

FWIW:

You cannot map the pages of a Word doc exactly to pages of InDesign without having page break special characters in your word file that indicate where to break.

You can manage the import a bit by setting inDesign's

app.wordRTFImportPreferences

See especially property convertPageBreaks

Regards,
Uwe

alexanderk57613459
Participating Frequently
February 5, 2017

Thanks, Uwe.

1.>> If there is more text in the story that the text frame can actually hold,

        -Exactly

         According to the description of the place() method parameter the last one seems to be for the automatic additional frames adding.

            .place(File("C:/js/klb.doc"),[myX, myY],undefined,false,true);

2.But it does not. Although it works in case of adding the linked frames to the initial one.

   I mean i can to place and link the empty frames before the placing of doc file - but the issue is to define the word document page   amount before the placing to add exact the same amoount of frames.

3.>>Also see the problem for recomposing text by working with a loop for adding text frames while a story overflows.
   I've found some example of this solution - I'm going to try to implement it.

4.>>You can manage the import a bit by setting inDesign's app.wordRTFImportPreferences See especially property convertPageBreaks

The page breaks are not the issue in my case (at least with my current word document). I've seen this properties set before - seems like the adjusting of this could be the next step.

Thanks.

-Alex.

Community Expert
February 5, 2017

Hi Alex,

what is the object you are using method place() with?

If it is the Page object the method comes indeed with 5 arguments, arguments 2 to 5 are optional:

fileName

placePoint

destinationLayer

autoflowing

withProperties

If it is insertionPoint only 2 arguments are possible:

fileName

withProperties

I tested with object Page and a text file with page.place() and had no problems to autoflow the whole text.
Maybe you do not use page.place(), but insertionPoint.place() ?

Or something's in your Word document that makes the whole story overflow permanently?

An image perhaps?

Just tested this with an image of dimensions that exceeds the area that the column margins of the InDesign page suggests.
That's indeed a show stopper. The frames were automatically build up to the point where the image was placed in the doc file.

Regards,
Uwe