How can I change CanGrow and MaxNumberOfLines properties of FieldObject Programmatically? RRS feed

  • Question

  • User-1330070619 posted

    I could not figure out how to change the CanGrow and MaxNumberOfLines properties of FieldObject properties programmatically. Any help will be greatly appreciated.

    Tuesday, May 13, 2008 6:47 PM

All replies

  • User1304833543 posted

     Using the given below Code you can Change the CanGrow properties Programmatically

    Dim Report As New CrystalReport1()

    Report.ReportDefinition.Sections("Section1").ReportObjects("DateTo1").ObjectFormat.EnableCanGrow = True


    Wednesday, May 14, 2008 3:12 AM
  • User-1330070619 posted

    Thanks, but what about MaxNumberOfLines?

    Wednesday, May 14, 2008 3:32 AM
  • User-350492254 posted

    First, reference of CrystalDecisions.ReportAppServer.ReportDefModel in your project.

    var repObjects = repClass.ReportDefinition.ReportObjects;
    var txtObject = repObject["Text1"] as CrystalDecisions.CrystalReports.Engine.TextObject;
    var txtFormat = txtObject.ObjectFormat;
    var Hack = BindingFlags.NonPublic | BindingFlags.Instance;
    ISCRTextObject rasReportObject = txtFormat.GetType().GetProperty("RasReportObject", Hack).GetValue(txtFormat, null) as ISCRTextObject;
    rasReportObject.MaxNumberOfLines = 1;
    txtFormat.EnableCanGrow = true;

    Thursday, April 9, 2015 4:21 AM