Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hello, Uwe.
1.The call was for the page:
The call was the exact
myDocument.pages[0].place( File("C:/js/klb.doc"), //File
[myX, myY], //PlacePoint
undefined, //DestinationPoint
false, //ShowingOptions
true); //Awtoflowing
Although I've found slightly another parameters order for place() function.
May be I've mixed the arguments into the wrong places.
But as far as I remember - I've attempted to apply different combinations of false/true.
2.My doc is pure text without page breaks or something like this.
It works for the first page i mean I've got pdf with only one filled page with one text frame (overflowed I suppose) with all doc text within.
Thanks.
-Alex.
Copy link to clipboard
Copied
Strange.
What is the exact version of InDesign?
Regards,
Uwe
Copy link to clipboard
Copied
Hello, Uwe.
The issue was with the wrong parameters order.
Your order is correct.
For doc it works fine (in 10 secs for 148 pages).
But the server hangs with docx.
Thanks.
-Alex.