In a crystal report, I want to set alignment of a fields accordingly. How can i do the same at run time?
That's nice.This is working.Thanks.I did same, and code is shown below.
var fo = rpt.ReportDefinition.ReportObjects["InvoiceComment"];
fo.ObjectFormat.HorizontalAlignment = Alignment.LeftAlign;
if (ds.Tables[0].Rows[0].ItemArray[19].ToString() == "Right")
fo.ObjectFormat.HorizontalAlignment = Alignment.RightAlign;
else
if (ds.Tables[0].Rows[0].ItemArray[19].ToString() == "Center")
fo.ObjectFormat.HorizontalAlignment = Alignment.HorizontalCenterAlign;`
But I'm going through another problem now.
FieldObject fo = rpt.ReportDefinition.ReportObjects["InvoiceComment"] as FieldObject;
OR
var fo = rpt.ReportDefinition.ReportObjects["InvCom"];
Are showing same error "Index was outside the bounds of the array." And if I use Another code instead of that it works.
FieldObject fo = rpt.ReportDefinition.ReportObjects[35] as FieldObject;
How to encurr this. Thanks in Advance.