Hi All
I want to apply underline on selected text but when i select text with itemByRange() then text not selected.
itemByRange() return array of characters.when i store array of characters in var type variable character and try to
underline then it give error object is invalid in line 7.In which type of variable I store character of array. I also try array type of variable but not sucess.How select text ?
var myDocument = app.documents.add();
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["10p", "15p", "30p", "35p"];
myTextFrame.contents = "Adobe Indesign";
var character=myTextFrame.characters.itemByRange(7,14); // for selection of Indesign in "Adobe Indesign"
character.underline=true; // error object is invalid
Thanks.
Thanks Vamitul for reply
When I try to underline every character individualy using
character[0].underline=true;
It give error Object does not support the property or method '0'.
I also try this :
var character = new Array();
character =myTextFrame.characters.itemByRange(7,14);
character[0].underline=true; // error Object does not support the property or method '0'.
But give error.
Which type of variable store characters array ?
I try this but give same error
var text =myTextFrame.texts.itemByRange(7,14);
text.underline=true; // error object is invalid
How select a text range and underline this?
Thanks
try counting from 0!!!
try this:
var myDocument = app.documents.add();
var myTextFrame = myDocument.pages.item(0).textFrames.add();
myTextFrame.geometricBounds = ["10p", "15p", "30p", "35p"];
myTextFrame.contents = "Adobe Indesign";
var character=myTextFrame.characters.itemByRange(6,13); // for selection of Indesign in "Adobe Indesign"
character.underline=true; // error object is invalid
North America
Europe, Middle East and Africa
Asia Pacific