Click to See Complete Forum and Search --> : Crystal report problem (Dynamic Reporting)


Vertygo
May 23rd, 2005, 08:19 AM
Hello,
How to dynamicly create text box on blank report and (or) how to move text box inside the report i mean to change its height,width or position if it is possible.
vb or c#
thanks

Fgerman
September 9th, 2005, 10:19 AM
I need the same thing, please if anybody knows how to this. help us

Vertygo
September 9th, 2005, 01:03 PM
Fgerman: after long search i didnt found much for CR, but i found alot for Component One (C1) reports. To dynamicly build whole report out from database!

epruben
July 7th, 2008, 02:40 PM
This answer is probably coming 3 years too late for those who posted it originally. Hopefully someone will find it useful.

The best way I found to add dynamic crystal report objects at is to add any objects your report might need to designer (at design time) and then change their size, location and text property in code at runtime.

For Example, To add a dynamic report title with Text "Report Name":
1. Drag and Drop a TextObject into the ReportHeader section of the rpt file
2. Rename the ReportHeader section to "ReportHeader"
3. Rename the Text Object reportName.

Then in code.

void ShowTitle()
{
ReportDocument rep = new ReportDocument();
ReportObject objName = rep.ReportDefinition.Sections ["ReportHeader"].ReportObjects["reportName"];
TextObject txtName = (TextObject)objName;
txtName.Text = "Report Name";
txtName.Left = 2000;
txtName.Text = 2000;
txtName.Height = 400;
txtName.Width = 2000;
}

void HideTitle()
{
ReportDocument rep = new ReportDocument();
ReportObject objName = rep.ReportDefinition.Sections["ReportHeader"].ReportObjects["reportName"];
TextObject txtName = (TextObject)objName;
txtName.Text = "";
txtName.Left = 0;
txtName.Text = 0;
txtName.Height = 0;
txtName.Width = 0;
}

keep in mind that the size and location of crystal reports objects is given in Twips and 1 pt = 20 twips.
hope this helps
Eric