Page 2
Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.
Introduction This document shows how to do the following: ➤ Work with the Adobe® InCopy® scripting environment. ➤ Use advanced scripting features. ➤ Work with text and type in an InCopy document, including finding and changing text. ➤ Create dialog boxes and other user-interface items.
Getting Started Scripting is the most powerful feature in Adobe® InCopy® CS4. No other feature—no tool, panel, or dialog box you see in the program’s user interface—can save you as much time, trouble, and money as scripting. This document is for every InCopy user. It does not matter if you never created a script before; this manual shows you how to get started.
ExtendScript. ExtendScript examples will not work in other JavaScript versions. : Because ExtendScript tools and features are used in several Adobe products, we consolidated all ExtendScript documentation. To learn more about JavaScript utilities like the ExtendScript Toolkit (a JavaScript development environment and object-model inspector) and the ScriptUI user-interface module, see Creative Suite 3 JavaScript Tools Guide.
If you do not have access to the script archive, you can enter the scripting code shown in this chapter. To do this: 1. Copy the script from this Adobe PDF document and paste it into the ExtendScript Toolkit. 2. Save the script as a plain-text file in the Scripts Panel folder (see “Installing scripts”...
Getting Started Scripting terminology and the InCopy object model 10 Walking through the script This section presents a step-by-step analysis of what the script above does. 1. Establish communication with the InCopy application object: Refer to the application as 2. Create a new document and a reference to the document: Var myDocument = app.documents.add();...
Page 11
Getting Started Scripting terminology and the InCopy object model 11 Value Type What it is Example Boolean Logical True or False True Integer Whole numbers (no decimal points). Integers can be positive or negative. Number A high-precision number that can 13.9972 contain a decimal point.
Getting Started Scripting terminology and the InCopy object model 12 Try to use descriptive names for your variables, like , rather than . This firstPage corporateLogo makes your script easier to read. Longer names do not affect the execution speed of the script. Variable names must be one word, but you can use internal capitalization (like ) or myFirstPage...
Getting Started Scripting terminology and the InCopy object model 13 Control structures If you could talk to InCopy, you might say, “Repeat the following procedure twenty times. ” In scripting terms, this is a control structure. Control structures provide repetitive processes, or loops. The idea of a loop is to repeat an action over and over again, with or without changes between instances (or iterations) of the loop, until a specific condition is met.
Page 14
Getting Started Scripting terminology and the InCopy object model 14 application documents a document libraries document preferences books document defaults application preferences document events application defaults document properties application events document methods application menus document elements application properties pages or spreads application methods page stories...
Page 15
Getting Started Scripting terminology and the InCopy object model 15 Term What it represents: Document Document default settings, such as colors, paragraph styles, and text formatting defaults defaults. Document For example, the stories, imported graphics, and pages of a document. The figure above elements shows pages and stories, because those objects are extremely important containers for other objects;...
Getting Started Scripting terminology and the InCopy object model 16 3. From the Classes list, select the object you want to view, then click the property or method you want to view in more detail in the Properties and Methods list. The ExtendScript toolkit displays more infor- mation on the property or method you selected: For more on using the ExtendScript Toolkit object model viewer, see Creative Suite 4 JavaScript Tools Guide.
Getting Started Adding features to “Hello World” 17 “1p6, ” is returned as “1.5. ” InCopy does this because your scripting system would have trouble trying to perform arithmetic operations using measurement strings. For instance, trying to add “0p3.5” to “13p4” produces a script error, while adding .2916 to 13.333 (the converted pica measurements) does not.
Page 18
Getting Started Adding features to “Hello World” 18 //Get a reference to a font. try{ //Enter the name of a font on your system, if necessary. var myFont = app.fonts.item("Arial"); on(myError){} //Get the active document and assign the result to the variable "myDocument" var myDocument = app.documents.item(0);...
Scripting Features This chapter covers scripting techniques that relate to InCopy’s scripting environment. Almost every other object in the InCopy scripting model controls a feature that can change a document or the application defaults. By contrast, the features in this chapter control how scripts operate. This document discusses the following: ➤...
Scripting Features Getting the current script 20 Property Description This property controls the alerts and dialogs InCopy presents to the user. userInteractionLevel When you set this property to UserInteractionLevels.neverInteract InCopy does not display any alerts or dialogs; set it to to enable alerts but UserInteractionLevels.interactWithAlerts disable dialogs;...
Scripting Features Script versioning 21 Script versioning InCopy CS4 can run scripts using earlier versions of the InCopy scripting object model. To run an older script in a newer version of InCopy, you must consider the following: ➤ Targeting — Scripts must be targeted to the version application in which they are being run (i.e., the current version).
+= "myInCopy.ScriptArgs.SetValue \"ScriptArgumentB\", \"This is the second script argument value.\""; app.doScript(myVBScript, ScriptLanguage.visualBasic); else{ var myAppleScript = "tell application \"Adobe InCopy CS4\"\r"; myAppleScript += "make script arg with properties{name:\"ScriptArgumentA\", value:\"This is the first script argument value.\"}\r"; myAppleScript += "make script arg with properties{name:\"ScriptArgumentB\", value:\"This is the second script argument value.\"}\r";...
Page 24
Scripting Features Session and main script execution 24 You can create your own persistent ExtendScript interpretation and execution environment. To do this, use statement and provide your own ExtendScript engine name, as shown in the #targetenging following script fragment: #targetengine "adobe"...
Text and Type Entering, editing, and formatting text make up the bulk of the time spent working on most InCopy documents. As a result, automating text and type operations can result in large productivity gains. This tutorial shows how to script the most common operations involving text and type. The sample scripts in this chapter are presented in order of complexity, starting with very simple scripts and building toward more complex operations.
Text and Type Entering and importing text 26 Replacing text The following script replaces a word with a phrase, by changing the contents of the appropriate object (for the complete script, see ReplaceWord): //Enters text in the default story and then replaces //a word in the story with a different phrase.
Page 28
Text and Type Placing text and setting text-import preferences 28 //TextImportCharacterSet.windowsCE //TextImportCharacterSet.windowsCyrillic //TextImportCharacterSet.windowsEE //TextImportCharacterSet.windowsGreek //TextImportCharacterSet.windowsTurkish characterSet = TextImportCharacterSet.unicode; convertSpacesIntoTabs = true; spacesIntoTabsCount = 3; //The dictionary property can take any of the following //language names (as strings): //Bulgarian //Catalan //Croatian //Czech //Danish //Dutch...
Page 29
Text and Type Placing text and setting text-import preferences 29 The following script shows how to set tagged text-import preferences (for the complete script, see TaggedTextImportPreferences): //Sets the tagged text import filter preferences. with(app.taggedTextImportPreferences){ removeTextFormatting = false; //styleConflict property can be: //StyleConflict.publicationDefinition //StyleConflict.tagFileDefinition styleConflict = StyleConflict.publicationDefinition;...
Text and Type Exporting text and setting text-export preferences 30 The following script shows how to set Excel import preferences (for the complete script, see ExcelImportPreferences): //Sets the Excel import filter preferences. with(app.excelImportPreferences){ //alignmentStyle property can be: //AlignmentStyleOptions.centerAlign //AlignmentStyleOptions.leftAlign //AlignmentStyleOptions.rightAlign //AlignmentStyleOptions.spreadsheet alignmentStyle = AlignmentStyleOptions.spreadsheet;...
Page 31
Text and Type Exporting text and setting text-export preferences 31 The following example shows how to export a specific range of text. (We omitted the myGetBounds function from this listing; see the ExportTextRange tutorial script.) var myDocument = app.documents.add(); var myStory = myDocument.stories.item(0); //Fill the story with placeholder text.
Page 32
Text and Type Exporting text and setting text-export preferences 32 Do not assume you are limited to exporting text using existing export filters. Since JavaScript can write text files to disk, you can have your script traverse the text in a document and export it in any order you like, using whatever text-markup scheme you prefer.
Page 33
Text and Type Exporting text and setting text-export preferences 33 else{ //Handle text style range export by iterating //through the text style ranges in the paragraph. for(var myRangeCounter = 0; myRangeCounter < myParagraph.textStyleRanges.length; myRangeCounter ++){ myTextStyleRange = myParagraph.textStyleRanges. item(myRangeCounter); if(myTextStyleRange.characters.item(-1)=="\r"){ myString = myTextStyleRange.texts.itemByRange (myTextStyleRange.characters.item(1), myTextStyleRange.characters.item(-2)).
Text and Type Text objects 34 //Close the text file. myTextFile.close(); function myFindTag (myStyleName, myStyleToTagMapping){ var myTag = ""; var myDone = false; var myCounter = 0; if(myStyleToTagMapping[myCounter][0] == myStyleName){ myTag = myStyleToTagMapping[myCounter][1]; break; myCounter ++; } while((myDone == false)||(myCounter < myStyleToTagMapping.length)) return myTag;...
Text and Type Text objects 35 For any text-stream object, the of the object is the story containing the object. To get a reference parent to the text frame (or text frames) containing a given text object, use the property. parentTextFrames For a text frame, the of the text frame usually is the page or spread containing the text frame.
Text and Type Text objects 36 Moving and copying text To move a text object to another location in text, use the method. To copy the text, use the move method (which is identical to the method in every way but its name). The following script duplicate move fragment shows how it works (for the complete script, see MoveText):...
Text and Type Text objects 37 //Shows how to remove formatting from text as you move it //to other locations in a document. //Create an example document. var myDocument = app.documents.add(); var myStory = myDocument.stories.item(0); myStory.contents = "This is a formatted string.\rText pasted after this text will retain its formatting.\r\rText moved to the following line will take on the formatting of the insertion point.\rItalic: ";...
Text and Type Formatting text 38 //Shows the correct way to iterate through text. var myDocument = app.documents.add(); var myString = "Paragraph 1.\rDelete this paragraph.\rParagraph 2.\rParagraph 3.\rParagraph 4.\rParagraph 5.\rDelete this paragraph.\rParagraph 6.\r"; var myStory = myDocument.stories.item(0); myStory.contents = myString; //The following for loop will format all of the paragraphs by iterating //backwards through the paragraphs in the story.
= myString; familyName<tab>fontStyle familyName : Font names typically are of the form , where is the name fontStyle of the font family, is a tab character, and is the name of the font style. For example: <tab> "Adobe Caslon Pro<tab>Semibold Italic"...
= app.fonts.item(myFontName); You also can apply a font by specifying the font-family name and font style, as shown in the following script fragment: myText.appliedFont = app.fonts.item("Adobe Caslon Pro"); myText.fontStyle = "Semibold Italic"; Changing text properties Text objects in InCopy have literally dozens of properties corresponding to their formatting attributes.
Text and Type Formatting text 43 Changing text color You can apply colors to the fill and stroke of text characters, as shown in the following script fragment (from the TextColors tutorial script): //Given two colors "myColorA" and "myColorB"... var myStory = myDocument.stories.item(0); //Enter text in the text frame.
Page 44
Text and Type Formatting text 44 try{ myCharacterStyle = myDocument.characterStyles.item("myCharacterStyle"); //If the style does not exist, trying to get its name generates an error. myName = myCharacterStyle.name; catch (myError){ //The style did not exist, so create it. myCharacterStyle = myDocument.characterStyles.add({name:"myCharacterStyle"}); //At this point, the variable myCharacterStyle contains a reference to a //character-style object, which you can now use to specify formatting.
Text and Type Finding and changing text 45 Deleting a style When you delete a style using the user interface, you can choose how you want to format any text tagged with that style. InCopy scripting works the same way, as shown in the following script fragment (from the RemoveStyle tutorial script): //Remove the paragraph style myParagraphStyleA and replace with myParagraphStyleB.
Text and Type Finding and changing text 46 Find/change preferences Before searching for text, you probably will want to clear find and change preferences, to make sure the settings from previous searches have no effect on your search. You also need to set a few find and change preferences to specify the text, formatting, regular expression, or glyph you want to find and/or change.
Text and Type Finding and changing text 47 The following script fragment shows how to find a specified string of text and replace it with a different string (for the complete script, see ChangeText): //Clear the find/change preferences. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing;...
Text and Type Finding and changing text 48 You also can search for a string of text and apply formatting, as shown in the following script fragment (from the FindChangeStringFormatting tutorial script): //Clear the find/change preferences. app.findTextPreferences = NothingEnum.nothing; app.changeTextPreferences = NothingEnum.nothing; //Set the find options.
Page 49
Text and Type Finding and changing text 49 One handy use for grep find/change is to convert text markup (i.e., some form of tagging plain text with formatting instructions) into InCopy formatted text. PageMaker paragraph tags (which are not the same as PageMaker tagged text-format files) are an example of a simplified text-markup scheme.
Text and Type Tables 50 function myRemoveDuplicates(myArray){ //Semi-clever method of removing duplicate array items; much faster //than comparing every item to every other item! var myNewArray = new Array; myArray = myArray.sort(); myNewArray.push(myArray[0]); if(myArray.length > 1){ for(var myCounter = 1; myCounter < myArray.length; myCounter ++){ if(myArray[myCounter] != myNewArray[myNewArray.length -1]){ myNewArray.push(myArray[myCounter]);...
Page 51
Text and Type Tables 51 var myStory = myDocument.stories.item(0); var myStartCharacter = myStory.paragraphs.item(6).characters.item(0); var myEndCharacter = myStory.paragraphs.item(6).characters.item(-2); var myText = myStory.texts.itemByRange(myStartCharacter, myEndCharacter); //The convertToTable method takes three parameters: //[ColumnSeparator as string] //[RowSeparator as string] //[NumberOfColumns as integer] (only used if the ColumnSeparator //and RowSeparator values are the same) //In the last paragraph in the story, columns are separated by commas //and rows are separated by semicolons, so we provide those characters...
Page 52
Text and Type Tables 52 The following script fragment shows how to create header and footer rows in a table (for the complete script, see HeaderAndFooterRows): var myTable = app.documents.item(0).stories.item(0).tables.item(0); //Convert the first row to a header row. myTable.rows.item(0).rowType = RowTypes.headerRow; //Convert the last row to a footer row.
Page 53
Text and Type Tables 53 The following script fragment shows how to process the selection when text or table cells are selected. In this example, the script displays an alert for each selection condition, but a real production script would then do something with the selected item(s).
Text and Type Autocorrect 54 Autocorrect The autocorrect feature can correct text as you type. The following script shows how to use it (for the complete script, see Autocorrect): //The autocorrect preferences object turns the //autocorrect feature on or off. app.autoCorrectPreferences.autoCorrect = true;...
: InCopy scripts written in JavaScript also can include user interfaces created using the Adobe ScriptUI component. This chapter includes some ScriptUI scripting tutorials; for more information, see Adobe Creative Suite®...
User Interfaces Your first InCopy dialog box 56 Dialog-box element InCopy name Text-edit fields Text editbox control Numeric-entry fields Real editbox, integer editbox, measurement editbox, percent editbox, angle editbox Pop-up menus Drop-down control Control that combines a text-edit field with a Combo-box control pop-up menu Check box...
User Interfaces Adding a user interface to “Hello World” 57 Adding a user interface to “Hello World” In this example, we add a simple user interface to the Hello World tutorial script presented in Chapter 2, “Getting Started.” The options in the dialog box provide a way for you to specify the sample text and change the point size of the text.
Page 58
User Interfaces Creating a more complex user interface 58 For the complete script, see ComplexUI. var myDialog = app.dialogs.add({name:"ComplexUI", canCancel:true}); with(myDialog){ var mySwatchNames = app.swatches.everyItem().name; //Add a dialog column. with(dialogColumns.add()){ //Create a border panel. with(borderPanels.add()){ with(dialogColumns.add()){ with(dialogRows.add()){ //The following line shows how to set a property //as you create an object.
Working with ScriptUI JavaScripts can make, create, and define user-interface elements using an Adobe scripting component named ScriptUI. ScriptUI gives scripters a way to create floating palettes, progress bars, and interactive dialog boxes that are far more complex than InCopy’s built-in object.
User Interfaces Working with ScriptUI 60 Creating a progress bar with ScriptUI The following sample script shows how to create a progress bar using JavaScript and ScriptUI, then use the progress bar from an (for the complete script, see ProgressBar): #targetengine "session"...
Page 61
User Interfaces Working with ScriptUI 61 For example: <buttons> <button> <buttonType>text</buttonType> <buttonName>FindChangeByList</buttonName> <buttonFileName>/c/buttons/FindChangeByList.jsx</buttonFileName> <buttonIconFile></buttonIconFile> </button> <button> <buttonType>text</buttonType> <buttonName>SortParagraphs</buttonName> <buttonFileName>/c/buttons/SortParagraphs.jsx</buttonFileName> <buttonIconFile></buttonIconFile> </button> </buttons> The following functions read the XML file and set up the button bar: #targetengine "session" var myButtonBar; main(); function main(){ myButtonBar = myCreateButtonBar();...
Page 62
User Interfaces Working with ScriptUI 62 return myButtonBar; function myReadXMLPreferences(){ myXMLFile = File.openDialog("Choose the file containing your button bar defaults"); var myResult = myXMLFile.open("r", undefined, undefined); var myButtons = ""; if(myResult == true){ var myXMLDefaults = myXMLFile.read(); myXMLFile.close(); var myXMLDefaults = new XML(myXMLDefaults); var myButtons = myXMLDefaults.xpath("/buttons/button");...
Menus InCopy scripting can add menu items, remove menu items, perform any menu command, and attach scripts to menu items. This chapter shows how to work with InCopy menu scripting. The sample scripts in this chapter are presented in order of complexity, starting with very simple scripts and building toward more complex operations.
Page 64
Menus Understanding the menu model 64 application menuActions menuAction area checked enabled eventListeners eventListener eventListener index label name events event event parent title scriptMenuActions scriptMenuAction same as menuAction To create a list (as a text file) of all visible menu actions, run the following script fragment (from the GetMenuActions tutorial script): var myMenuActionNames = app.menuActions.everyItem().name;...
Menus Understanding the menu model 65 var myMenu; //Open a new text file. var myTextFile = File.saveDialog("Save Menu Action Names As", undefined); //If the user clicked the Cancel button, the result is null. if(myTextFile != null){ //Open the file with write access. myTextFile.open("w");...
Menus Working with script menu actions 68 Working with script menu actions You can use to create a new whose behavior is implemented through the scriptMenuAction menuAction script registered to run when the is triggered. onInvoke event The following script shows how to create a and attach it to a menu item (for the scriptMenuAction complete script, see MakeScriptMenuAction).
Page 69
Menus Working with script menu actions 69 about to be displayed). Among other things, the script can then change the menu names and/or set the enabled/checked status. In the following sample script, we add an to the that checks the eventListener beforeDisplay event current selection.
Events InCopy scripting can respond to common application and document events, like opening a file, creating a new file, printing, and importing text and graphic files from disk. In InCopy scripting, the object event responds to an event that occurs in the application. Scripts can be attached to events using the scripting object.
Page 71
Events Understanding the event scripting model 71 User-Interface event Event name Description Object type Any menu Appears before the menu or Event beforeDisplay action submenu is displayed. Appears before the script menu Event beforeDisplay action is displayed or changed. Appears after the menu action is Event beforeInvoke chosen but before the content of the...
Events Understanding the event scripting model 72 User-Interface event Event name Description Object type Revert Appears after a document revert DocumentEvent beforeRevert request is made but before the document is reverted to an earlier saved state. Appears after a document is reverted DocumentEvent afterRevert to an earlier saved state.
Events Working with eventListeners 73 Property Description If true, the propagates to scripting objects above the object initiating Bubbles event event If true, the default behavior of the on its can be canceled. To do Cancelable event target this, use the method.
Page 74
Events Working with eventListeners 74 event can be observed by associated with both the application and the afterOpen eventListeners document. do not persist beyond the current InCopy session. To make an available eventListeners eventListener in every InCopy session, add the script to the startup scripts folder (for more on installing scripts, see Chapter 2, “Getting Started.”).
Extensible Markup Language, or XML, is a text-based mark-up system created and managed by the World Wide Web Consortium (www.w3.org). Like Hypertext Markup Language (HTML), XML uses angle brackets to indicate markup tags (for example, ). While HTML has a predefined set of tags, <article>...
Scripting XML Elements 78 Setting XML preferences You can control the appearance of the InCopy structure panel using the XML view-preferences object, as shown in the following script fragment (from the XMLViewPreferences tutorial script): var myDocument = app.documents.add(); var myXMLViewPreferences = myDocument.xmlViewPreferences; myXMLViewPreferences.showAttributes = true;...
Scripting XML Elements 79 Importing XML Once you set the XML-import preferences the way you want them, you can import an XML file, as shown in the following script fragment (from the ImportXML tutorial script): myDocument.importXML(File("/c/completeDocument.xml")); When you need to import the contents of an XML file into a specific XML element, use the importXML method of the XML element, rather than the corresponding method of the document.
Scripting XML Elements 80 myDocument.saveXMLTags(File("/c/xml_tags.xml"), "Tag set created October 5, 2006"); Creating an XML element Ordinarily, you create XML elements by importing an XML file, but you also can create an XML element using InCopy scripting, as shown in the following script fragment (from the CreateXMLElement tutorial script): var myXMLTag = myDocument.xmlTags.add("myXMLTag");...
Scripting XML Elements 81 var myDocument = app.documents.item(0); var myRootXMLElement = myDocument.xmlElements.item(0); //Duplicate the XML element containing "A" var myNewXMLElement = myRootXMLElement.xmlElements.item(0).duplicate(); //Change the content of the duplicated XML element. myNewXMLElement.contents = myNewXMLElement.contents + " duplicate"; Removing items from the XML structure To break the association between a text object and an XML element, use the method, as shown in untag...
Scripting XML Elements 82 The following script fragment shows how to add an XML attribute to an XML element (for the complete script, see MakeXMLAttribute): var myDocument = app.documents.item(0); var myRootXMLElement = myDocument.xmlElements.item(0); var myXMLElementB = myRootXMLElement.xmlElements.item(1); myXMLElementB.xmlAttributes.add("example_attribute", "This is an XML attribute. It will not appear in the layout!");...
Adding XML elements to a story 83 var myXMLStory = myDocument.xmlStories.item(0); //Though the text has not yet been placed in the layout, all text //properties are available. myXMLStory.texts.item(0).pointSize = 72; //Place the XML element in the layout to see the result. myDocument.xmlElements.item(0).xmlElements.item(0).placeXML(myDocument.pages.item(0).
Page 84
Adding XML elements to a story 84 var myXMLElement = myDocument.xmlElements.item(0).xmlElements.item(0); //By inserting the return character after the XML element, the character //becomes part of the content of the parent XML element, not of the element itself. myXMLElement.insertTextAsContent("\r", XMLElementPosition.afterElement); myXMLElement = myDocument.xmlElements.item(0).xmlElements.item(1); myXMLElement.insertTextAsContent("Static text: ", XMLElementPosition.beforeElement);...
Adding XML elements to a story 85 var myDocument = app.documents.item(0); //Create a style to tag mapping. myDocument.xmlExportMaps.add(myDocument.paragraphStyles.item("heading 1"), myDocument.xmlTags.item("heading_1")); myDocument.xmlExportMaps.add(myDocument.paragraphStyles.item("heading 2"), myDocument.xmlTags.item("heading_2")); myDocument.xmlExportMaps.add(myDocument.paragraphStyles.item("para 1"), myDocument.xmlTags.item("para_1")); myDocument.xmlExportMaps.add(myDocument.paragraphStyles.item("body text"), myDocument.xmlTags.item("body_text")); //Apply the style to tag mapping. myDocument.mapStylesToXMLTags(); Another approach is simply to have your script create a new XML tag for each paragraph or character style in the document, and then apply the style to tag mapping, as shown in the following script fragment (from the MapAllStylesToTags tutorial script): var myDocument = app.documents.item(0);...
Adding XML elements to a story 86 myPara1Style.firstLineIndent = 0; var myBodyTextStyle = myDocument.paragraphStyles.add(); myBodyTextStyle.name = "body text"; myBodyTextStyle.pointSize = 12; myBodyTextStyle.firstLineIndent = 24; //Create a character style. var myCharacterStyle = myDocument.characterStyles.add(); myCharacterStyle.name = "Emphasis"; myCharacterStyle.fontStyle = "Italic"; //Add XML elements and apply paragraph styles. var myRootXMLElement = myDocument.xmlElements.item(0);...
Page 87
Adding XML elements to a story 87 var myDocument = app.documents.add(); //Create a series of XML tags. var myRowTag = myDocument.xmlTags.add("row"); var myCellTag = myDocument.xmlTags.add("cell"); var myTableTag = myDocument.xmlTags.add("table"); //Add XML elements. var myRootXMLElement = myDocument.xmlElements.item(0); with(myRootXMLElement){ var myTableXMLElement = xmlElements.add(myTableTag); with(myTableXMLElement){ for(var myRowCounter = 1;myRowCounter <...
Page 88
Adding XML elements to a story 88 var myTable = myTableXMLElement.convertElementToTable(myRowTag, myCellTag); var myTableXMLElement = myDocument.xmlElements.item(0).xmlElements.item(0); myTableXMLElement.applyTableStyle(myTableStyle); myTableXMLElement.xmlElements.item(0).applyCellStyle(myCellStyle); myTableXMLElement.xmlElements.item(5).applyCellStyle(myCellStyle); myTableXMLElement.xmlElements.item(10).applyCellStyle(myCellStyle); myTableXMLElement.xmlElements.item(15).applyCellStyle(myCellStyle); myTableXMLElement.xmlElements.item(16).applyCellStyle(myCellStyle); myTableXMLElement.xmlElements.item(21).applyCellStyle(myCellStyle); myDocument.stories.item(0).placeXML(myDocument.xmlElements.item(0)); myTable.alternatingFills = AlternatingFillsTypes.alternatingRows;...