Morteza Bashardoost
Morteza Bashardoost

Reputation: 78

Change the Column width and Position programmatically in Crystal Reports

I want to create a report that has dynamic fields (columns). in the simpler words, there are 15 optional fields for user and the user will select 6 of them to be displayed in report.

so, for solution, I added all the columns in the report. and now I want to hide all non-selected columns and also change the width and position of the visible columns.

how can I do that in vb.net 2010 by coding?

Upvotes: 1

Views: 4180

Answers (2)

Lan
Lan

Reputation: 1346

If you want just to visualize the data I would suggest you to use a grid. Crystal report is good for static structures. If you need to export the grid to a pdf or Excel then you can use this tool: http://r-tag.com/Pages/BlogPost/1 Get a free license here: http://r-tag.com/Pages/CommunityEdition.aspx

Upvotes: 0

campagnolo_1
campagnolo_1

Reputation: 2750

As far as the width is concerned, you could use something like this, which will change the height and width (0 of course will hide it, so change it to a value that suits you).

Dim RptDoc As New ReportDocument
 Dim _fldName As FieldObject
 _fldName = RptDoc.ReportDefinition.ReportObjects("fieldObjectName")
_fldName.Width = 0
_fldName.Height = 0

About moving an object, you could try something like this:

myReport _myReport = new myReport ();
myReport .Section1.ReportObjects["myline"].Top = 10;

You need to be aware of the Section naming in your report and the correct line reference.

Upvotes: 1

Related Questions