Problem with cursor.charStyleName

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Problem with cursor.charStyleName

Postby lunter » Sat May 30, 2009 5:40 pm

Code: Select all   Expand viewCollapse view
// 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...
OOo 3.3.X on MS Windows 7
lunter
 
Posts: 28
Joined: Fri May 29, 2009 9:16 am

Re: problem with cursor.charStyleName

Postby squenson » Sat May 30, 2009 7:49 pm

Just an idea, the default style is called "default" so you may try with this value.
LibreOffice 4.2.3.3. on Ubuntu 14.04
User avatar
squenson
Volunteer
 
Posts: 1885
Joined: Wed Jan 30, 2008 9:21 pm
Location: Lausanne, Switzerland

Re: problem with cursor.charStyleName

Postby lunter » Sat May 30, 2009 9:14 pm

$c->charStyleName='Default';
or
$c->charStyleName='default';

returns errors...
OOo 3.3.X on MS Windows 7
lunter
 
Posts: 28
Joined: Fri May 29, 2009 9:16 am

Re: Problem with cursor.charStyleName

Postby j.kornelsn » Mon Mar 11, 2013 7:56 pm

This should work (tested in Python):
Code: Select all   Expand viewCollapse view
$c->setPropertyToDefault("CharStyleName");
$c->setAllPropertiesToDefault();
LO / AOO on Ubuntu / Windows
j.kornelsn
 
Posts: 13
Joined: Wed Oct 06, 2010 6:26 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests