Profile Picture

XLM Text Format

Posted By Volvick Derose 13 Years Ago
Author
Message
Volvick Derose
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 71, Visits: 1
Yes, I realized that after I posted the message. I did a step through and I found that it was null, then

I did something like that,

myRectangle.Style.TextStyle = new ..

and it worked fine

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Volvick,

Before accessing the TextFormat property, did you check whether the myRectangle.Style is not null and whether the myRectangle.Style.TextStyle is not null?

In general you should use the following code to safely assign a text style to a stylable element.

// create new text style
NTextStyle textStyle = new NTextStyle();
textStyle.TextFormat = TextFormat.XML;

// safely set it to a styleable element
NStyle.SetTextStyle(myRectangle, textStyle);

As all static style setters, defined by the NStyle class, this method will internally check whether the style of the element is created and create it if it is not already created.

Best Regards,
Nevron Support Team



Volvick Derose
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 71, Visits: 1
I keep getting an error when I try to set the text of a shape to xml format

NRectangleShape myRectangle = new NRectangle(100, 100, 200, 100);
myRectangle.Text = "htmltext";
NTextStyle textShapeStyle = new NTextStyle();
myRectangle.Style.TextStyle.TextFormat = TextFormat.XML;//keep getting an error here
myRectangle.Style.TextStyle = textShapeStyle;

I don't want to apply xml format to the whole document, only to that shape



Similar Topics


Reading This Topic