Skip to Content

For ... Loop

Jan 11 at 04:01 PM


avatar image
Former Member

Hi experts,

I have hundreds of reports. It is the appearance of the decimal point and after it two zeros such as (.00). I tried to get rid of them by design in the C# framework that did not work. I want a code to be applied to all fields of decimal type to get rid of (.00).

greetings to you all


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
Jan 11 at 04:24 PM

Hi Mohamad,

You need to use RAS and RCD Report Object and then clone the object, make the change and then preview:

CrystalDecisions.ReportAppServer.ReportDefModel.ReportObjects rptObjs;
rptObjs = rptClientDoc.ReportDefController.ReportObjectController.GetAllReportObjects();

foreach (CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject rptObj1 in rptObjs)
switch (rptObj1.Kind)
case CrReportObjectKindEnum.crReportObjectKindField:

CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject OldfieldObject = (CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject)rptObj1;
CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject NewfieldObject = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();

NewfieldObject = (CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject)OldfieldObject.Clone(true);

CrystalDecisions.ReportAppServer.ReportDefModel.NumericFieldFormat numericFieldFormat = NewfieldObject.FieldFormat.NumericFormat;
//CrystalDecisions.ReportAppServer.ReportDefModel.CrCurrencySymbolTypeEnum = CrCurrencySymbolTypeEnum.crCurrencySymbolTypeFixedSymbol;

if (OldfieldObject.FieldFormat.NumericFormat.NDecimalPlaces != 0)
((dynamic)NewfieldObject).FieldFormat.NumericFormat.NDecimalPlaces = 0;
rptClientDoc.ReportDefController.ReportObjectController.Modify(OldfieldObject, NewfieldObject);
rptClientDoc.ReportDefController.ReportObjectController.Modify(OldfieldObject, NewfieldObject);




10 |10000 characters needed characters left characters exceeded