Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Programaticaly add Heading(ITextobject) for every Fieldobject?

Hi to all,

My task is during run time add a table to CR then add fieldobjects and

display in the crystal report viewer, all are working fine but problem is the fields are displaying

without heading, i want to add the heading for every column in detail section.

This is my sample code

boFieldObject2 = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();

boFieldObject.DataSourceName = "{User_Images.imgId}";

boFieldObject.DataSource = "{User_Images.imgId}";

boFieldObject.Name = "imgId";

boFieldObject.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeInt32sField;

boFieldObject.Left = 4 * 1440; //1440 twips per inch

boFieldObject.Width = 3 * 1440;

boFieldObject.FontColor = new CrystalDecisions.ReportAppServer.ReportDefModel.FontColor();

boFieldObject.FontColor.Font.Name = "Arial";

boFieldObject.FontColor.Font.Size = 10;

//Add the object to the report

boReportClientDocument.ReportDefController.ReportObjectController.Add(boFieldObject, boSection, -1);

There is FieldHeadingObject i tried but unable to set the Text.

I'm using Crystal Report 11.5,Visual Studio2005-C#, 2.0 and SQL Server.

Experts please help me.

Former Member

The only way to directly add both the database field and the header at the same time, does not allow you to have full control of formatting of both parts being added. I would suggest adding additional code to add the headers you want as text objects to the page header section. See the sample for adding text objects in your other [post|Create ITextObject programaticaly;

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question