cancel
Showing results for 
Search instead for 
Did you mean: 

Programaticaly add Heading(ITextobject) for every Fieldobject?

Former Member
0 Kudos

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#,Asp.net 2.0 and SQL Server.

Experts please help me.

Accepted Solutions (1)

Accepted Solutions (1)

Adam_Stone
Active Contributor
0 Kudos

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|;

Answers (0)