Profile Picture

Change fontstyle for a cell in a table shape

Posted By Eric Sweet 14 Years Ago
Author
Message
Nevron Support
Posted 14 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,

The exception is caused by the fact that the style of any element is null by default because it inherits the style of its parent or the document it’s placed in. When setting styles always use the following approach:

 

NFontStyle fontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);

NStyle.SetTextStyle(table[0, 0], new NTextStyle(fontStyle, Color.Black));

 



Best Regards,
Nevron Support Team



Eric Sweet
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 14, Visits: 1
Hi,

I'm trying to make the title cell of a table shape bold, but I keep getting an error.

The code I'm using is:
shape(1, 0).Style.TextStyle.FontStyle = New NFontStyle("Arial", 10, FontStyle.Bold)

I'm getting a NullReference exception for that line of code:
Object reference not set to an instance of an object.

I'm stumped because this is very similar to code in the samples used to set fillstyle and strokestyle.

Any help greatly appreciated.

Thanks,
Eric



Similar Topics


Reading This Topic