Adobe 65009333 Scripting Guide - Page 30
Exporting text and setting text-export preferences
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 30 highlights
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; decimalPlaces = 4; preserveGraphics = false; //Enter the range you want to import as "start cell:end cell". rangeName = "A1:B16"; sheetIndex = 1; //You'll have to enter a valid worksheet name. sheetName = "pathpoints"; showHiddenCells = false; //tableFormatting property can be: //TableFormattingOptions.excelFormattedTable //TableFormattingOptions.excelUnformattedTabbedText //TableFormattingOptions.excelUnformattedTable tableFormatting = TableFormattingOptions.excelFormattedTable; useTypographersQuotes = true; viewName = ""; } Exporting text and setting text-export preferences The following script shows how to export text from an InCopy document. You must use text or story objects to export in text-file formats; you cannot export all the text in a document in one operation. (For the complete script, see ExportTextFile.) //Creates a story in an example document and then exports the text to a text file. var myDocument = app.documents.add(); var myStory = myDocument.stories.item(0); //Fill the story with placeholder text. var myTextFrame = myStory.textContainers[0]; myTextFrame.contents = TextFrameContents.placeholderText; //Text exportFile method parameters: //Format as ExportFormat //To As File //[ShowingOptions As Boolean = False] // //Format parameter can be: //ExportFormat.inCopyCSDocument //ExportFormat.inCopyDocument //ExportFormat.rtf //ExportFormat.taggedText //ExportFormat.textType // //Export the story as text. You'll have to fill in a valid file path on your system. myStory.exportFile(ExportFormat.textType, File("/c/test.txt"));