Style

edited 7:24PM in FastReport .NET
Hi,
how can I assign via code styles that I created with style editor?

Thanks

Comments

  • edited 7:24PM
    Hello,

    You have to add a Style to the report.Styles collection, then assign the style name to the report object's Style property:
    // create a new style
    Style style = new Style();
    style.Name = "MyStyle";
    style.Fill = new SolidFill(Color.Red);
    
    // add it to report styles
    report.Styles.Add(style);
    
    // apply a style to the Text object
    (report.FindObject("Text1") as TextObject).Style = "MyStyle";
    

Leave a Comment