Page 1 of 1

Problem with cursor.charStyleName

Posted: Sat May 30, 2009 5:40 pm
by lunter

Code: Select all

// php

 $t=$doc->Text;
 $c=$t->createTextCursor();

 $c->charStyleName='red';
 $t->insertString($c,'First paragraph',false);

 $t->insertControlCharacter($c,0,false); // PARAGRAPH_BREAK

 $c->charStyleName='blue';
 $t->insertString($c,'Second paragraph',false);

 $t->insertControlCharacter($c,0,false); // PARAGRAPH_BREAK

// $c->charStyleName=''; <-- error
 $t->insertString($c,'Third paragraph',false);
My first paragraph has red letter color (defined in CharacterStyles.red)
Second paragraph has blue letter color (defined in CharacterStyles.blue)

How to disable cursor charStyleName before writting third paragraph? It is still blue...

Re: problem with cursor.charStyleName

Posted: Sat May 30, 2009 7:49 pm
by squenson
Just an idea, the default style is called "default" so you may try with this value.

Re: problem with cursor.charStyleName

Posted: Sat May 30, 2009 9:14 pm
by lunter
$c->charStyleName='Default';
or
$c->charStyleName='default';

returns errors...

Re: Problem with cursor.charStyleName

Posted: Mon Mar 11, 2013 7:56 pm
by j.kornelsn
This should work (tested in Python):

Code: Select all

$c->setPropertyToDefault("CharStyleName");
$c->setAllPropertiesToDefault();