Page 1 of 1
Change Styles at runtime
Posted: Tue May 10, 2011 1:30 pm
by khalid89
Hi! I need to set the ComponentStyle, EvenStyle and OddStyle properties at runtime. I'm working on an ASP.NET project and I need to do it on my C# code.
I have tried with:
dataBand1.EvenStyle = "Data3";
dataBand1.OddStyle = "Data2";
(report.Pages["Page1"].GetComponents()["DataBand1"] as StiDataBand).EvenStyle = "";
(report.Pages["Page1"].GetComponents()["DataBand1"] as StiDataBand).OddStyle = "Odd";
StiText1.ComponentStyle = "Data3";
But I have no results.
I hope you can help me,
Best regards,
Seb . .
Change Styles at runtime
Posted: Wed May 11, 2011 8:08 am
by Alex K.
Hello,
First, you must add the desired style
Code: Select all
Stimulsoft.Report.StiStyle StyleData1 = new Stimulsoft.Report.StiStyle();
StyleData1.AllowUseBorderFormatting = false;
StyleData1.AllowUseBorderSides = false;
StyleData1.AllowUseFont = false;
StyleData1.AllowUseTextBrush = false;
StyleData1.AllowUseTextOptions = false;
StyleData1.Name = "Odd";
StyleData1.StyleCode = Stimulsoft.Report.StiStyleCode.None;
StyleData1.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black), false);
StyleData1.Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.FromArgb(255, 240, 237, 232));
StyleData1.Font = new System.Drawing.Font("Arial", 9F);
StyleData1.Image = null;
StyleData1.TextBrush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black);
report.Styles.Clear();
report.Styles.AddRange(new Stimulsoft.Report.StiBaseStyle[] {
StyleData1});
and then only to assign it:
Thank you.
Change Styles at runtime
Posted: Thu May 12, 2011 8:45 am
by khalid89
Aleksey, thanks a lot for your answer =)
If I want to add more than one Style, I have not use report.Styles.Clear(), am I right?
Best regards,
Seb . .
Change Styles at runtime
Posted: Fri May 13, 2011 2:02 am
by Alex K.
Hello,
You can define several styles and then add them to the collection of styles.
Thank you.