How can I pass the color as parameter from my c# code and how use this parameter in various element like line, rectangle, label , so I can manage the text and background color dynamically>
.....
Parameters.Add("textColor", "red");
Parameters.Add("backgroundColor", "red");
......
I need to use above passed parameter in below syntax in report writer.
<rectangle id="rectOrderSummery2" x="-22" y="10" height="55" width="300" borderWidth="1" borderColor="How To set passed color here" fillColor="How To set passed color here" cornerRadius="6"/>
Thanks in advance
How Can I pass colro as parameter ?
Re: How Can I pass colro as parameter ?
Support · Nov 7, 2012Hello,
You can dynamically set the properties of the report elements by accessing them using the ElementID. You can also set these properties in the LayingOut event of the respective report element. Below is the sample code for it.
DocumentLayout report = new DocumentLayout(@"C:\Temp\Sample.dplx");
//Accessing the Label using its ElementID.
ceTe.DynamicPDF.ReportWriter.ReportElements.Label label = (ceTe.DynamicPDF.ReportWriter.ReportElements.Label)report.GetElementById("Label1");
label.Text = "Changed Name";
label.TextColor = RgbColor.Red;
//Accessing the Rectangle using its ElementID.
ceTe.DynamicPDF.ReportWriter.ReportElements.Rectangle rectangle = (ceTe.DynamicPDF.ReportWriter.ReportElements.Rectangle)report.GetElementById("Rectangle1");
rectangle.FillColor = RgbColor.LightGreen;
rectangle.CornerRadius = 2;
Document document = report.Run();
document.Draw(@"C:\Temp\Output.pdf");
Thanks,
ceTe Software Support Team.
Re: How Can I pass colro as parameter ?
Forum member · Nov 7, 2012is it not directly manage in DPLX file?
Re: How Can I pass colro as parameter ?
Support · Nov 7, 2012Hello,
It is not possible to directly manage the report element properties in DPLX file by passing the parameters. You will need to access the report elements dynamically using ElementId and set the respective properties.
Thanks,
ceTe Software Support Team.