This is a migrated thread and some comments may be shown as answers.

In telerik report how to show two tables

5 Answers 321 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandeep Trivedi
Top achievements
Rank 1
Sandeep Trivedi asked on 29 Dec 2009, 01:48 PM
Hi

I want source code for adding  and showing two tables in one Report Book.

Thanks
Sandeep Trivedi

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 29 Dec 2009, 02:40 PM
Hello Sandeep,

Could you please let us know which product do you mean? RadControls for ASP.NET AJAX or Telerik Reporting?

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sandeep Trivedi
Top achievements
Rank 1
answered on 30 Dec 2009, 04:23 AM
Hi Daniel,
    Thanks for reply.

I mean to say about "Telerik Reporting".

Thanks
Sandeep Trivedi

 

0
Steve
Telerik team
answered on 04 Jan 2010, 10:20 AM
Hi Sandeep,

Please provide more info about your exact scenario that you are trying to accomplish. The Report Book feature aims at combining several reports into one and those reports do not have to be necessarily connected to each other. Also the Table item is a separate data region and in this line of thoughts you can have multiple Table items in a single report (i.e. no necessity for Report Book).
Generally the most straight-forward and easy way to learn the Reporting API is to create what you need through the Report Designer and then review the code it has generated in the InitializeComponent() method.

Regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Antonio
Top achievements
Rank 1
answered on 04 Nov 2011, 05:31 PM
Hello.

Using Telerik Reporting, Telerik_Reporting_Q3_2010_v4_2_10_1221_dev.

I've used Steve suggestion and have successfully created and designed a table at runtime.

But now I have a problem, I can't seem to place the second table in the correct place.

Can't see what I'm missing in my code. Can you help?

//table 1
Telerik.Reporting.Table carePlanTable3 = new Telerik.Reporting.Table();
carePlanTable3.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm));
carePlanTable3.Style.BackgroundColor = System.Drawing.Color.White;
 
//coluna 1
Telerik.Reporting.TableGroup tableGroupIntervention = new Telerik.Reporting.TableGroup();
carePlanTable3.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm)));
Telerik.Reporting.HtmlTextBox htmlTextBoxIntervention = new Telerik.Reporting.HtmlTextBox();
htmlTextBoxIntervention.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm));
htmlTextBoxIntervention.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
tableGroupIntervention.ReportItem = htmlTextBoxIntervention;
carePlanTable3.ColumnGroups.Add(tableGroupIntervention);
htmlTextBoxIntervention.Value = "A";
 
//coluna 2
Telerik.Reporting.TableGroup tableGroupSOS = new Telerik.Reporting.TableGroup();
carePlanTable3.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm)));
Telerik.Reporting.HtmlTextBox htmlTextBoxSOS = new Telerik.Reporting.HtmlTextBox();
htmlTextBoxSOS.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm));
htmlTextBoxSOS.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
tableGroupSOS.ReportItem = htmlTextBoxSOS;
carePlanTable3.ColumnGroups.Add(tableGroupSOS);
htmlTextBoxSOS.Value = "B";
 
//table 2
Telerik.Reporting.Table carePlanTable4 = new Telerik.Reporting.Table();
carePlanTable4.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm));
carePlanTable4.Style.BackgroundColor = System.Drawing.Color.White;
 
//coluna 1
Telerik.Reporting.TableGroup tableGroupIntervention1 = new Telerik.Reporting.TableGroup();
carePlanTable4.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm)));
Telerik.Reporting.HtmlTextBox htmlTextBoxIntervention1 = new Telerik.Reporting.HtmlTextBox();
htmlTextBoxIntervention1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm));
htmlTextBoxIntervention1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
tableGroupIntervention1.ReportItem = htmlTextBoxIntervention1;
carePlanTable4.ColumnGroups.Add(tableGroupIntervention1);
htmlTextBoxIntervention1.Value = "A";
 
//coluna 2
Telerik.Reporting.TableGroup tableGroupSOS1 = new Telerik.Reporting.TableGroup();
carePlanTable4.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Cm)));
Telerik.Reporting.HtmlTextBox htmlTextBoxSOS1 = new Telerik.Reporting.HtmlTextBox();
htmlTextBoxSOS1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm));
htmlTextBoxSOS1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
tableGroupSOS1.ReportItem = htmlTextBoxSOS1;
carePlanTable4.ColumnGroups.Add(tableGroupSOS1);
htmlTextBoxSOS1.Value = "B";
 
this.carePlanMainPanel.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
carePlanTable3,
carePlanTable4});

It's drawing like this:
Table.jpg

Why is it drawing the table 2 in that position?

Thank you.
0
Steve
Telerik team
answered on 07 Nov 2011, 09:18 AM
Hello Antonio,

Each report item should have Location and Size set and this is mandatory. Looking at your code, you have not set Size to the items and you also set the same Location for both tables which is not correct.

Greetings,
Steve
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

Tags
General Discussions
Asked by
Sandeep Trivedi
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Sandeep Trivedi
Top achievements
Rank 1
Steve
Telerik team
Antonio
Top achievements
Rank 1
Share this question
or