Sorry, second try:
Hi friends,
I am trying to copy the character attributes of one paragraph’s characters onto the characters of another paragraph. There may be up to (say) 10 different types of local formatting in the source paragraph. The rules on how to do this are complicated: it’s not simply that character[1] of the destination paragraph should look like the character[1] of the source, and so on with char[2], char[3] etc., the special chars are mixed up, the number of characters and even the language of the two paragraphs are different.
My problem is that I can’t get (or set, btw.) the attributes like this:
myChrProps=myParagraph.characters[i].properties;
because I get error message: Object is invalid.
Okay, I tried this:
myTemp=myParagraph.characters.everyItem().getElements();
myChrProps=myTemp[i].properties;
Te result is the same, error message on the first line.
Well, let’s try this:
myTemp=myParagraph; alert(myTemp+"\r"+myTemp.length);
myTemp=myTemp.characters; alert(myTemp+"\r"+myTemp.length);
myTemp=myTemp.everyItem(); alert(myTemp+"\r"+myTemp.length);
myTemp=myTemp.getElements(); alert(myTemp+"\r"+myTemp.length);
myChrprops=myTemp[i].properties;
Aaaaaand victory!!! I could even define a character style with the props I got in response.
BUT the same code without the alerts leads to the error message again.
Can someone explain me what’s going on?
Tom