c# - how to paint line in crystalReport by value -


I have my database which is shown by crystal report, it has field ID and name.

I need that if the value of id = 8 will paint the line in the crystal report

and if the id = 10 is green in it.

I use C # VS 2008

Thank you in advance

OK ... you forced me to install a Windows XP in the virtual machine and VS 2008 to find this answer ...;) Anyway, this is the answer ...
You should write this code where ever you want to show the report:
First of all, add this reference to your code:

  CrystalDecisions.CrystalReports.Engine's Using;  

Then you can use your object (in our case its LineObject ) like this:

report document Report Doc = CrystalReport11; // 1- define a line object variable lineObject myLine; // Find the object in the Reports object collection and enter it as LineObject // and finally, set it in my variable myLine = (LineObject) report.Doc.ReportDefinition.ReportObjects ["Line1"]); // Make your changes ... myLine.LineColor = Color.Red;

I have defined you as ReportDocument to show you how to do this with dynamically loaded reports ... Good luck! / P>


Comments