Here's the situation. I have a Telerik Report document. In the Detail row, there are three columns, each with one field.
The fields can grow, and do based on the data in the field; so there may be multiple lines on some of the fields.
If I just put borders around the fields, then the boxes are all different heights, depending on what is in the fields.
(like this sketch:)
---------------------------
| | | | <-Record 1
--------| | |
| |-------|
----------
---------------------------
| | | | <-Record 2
--------| | |
----------| |
---------
I need for all three columns to be the same height boxes.
When done, the page should basically be a grid of boxes with the details from each record filled into the fields:
--------------------
| | | | <- Record 1
| | | |
--------------------
| | | | <- Record 2
---------------------
Hope I am making sense... Anyone have any ideas on how to accomplish this?
Thanks!
-Chuck
21 Answers, 1 is accepted
Use a Panel and put your fields inside the panel, all of them on the same one.
Now set the border of th Panel and that should work like you want!
Hope it helps!
Ricardo
That works great for the outside bounding box, but how can I get vertical Separator lines between the fields that are of a variable length?
Thanks for your assistance on this!
-Chuck
For now there is no way to achieve the desired result. We are planning to include a Table report item for the next version which will make this task possible. Please, review the Reporting Roadmap page for more information on the next version.
Regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Hope it works!
Ricardo
Is there a way to adjust the line(from shape tool) height dynamically, based on the height of the panel?
Regards,
Chuck
Your line is called endLine.
All you do is use endLine.Size.Height or endLine.Size.Width to set it equal to the height or width of your box.
So, to make the dynamic vertical lines, use something like this:
endLine.Size.Height = yourBox.Size.Height;
See how that works!
Ricardo
I see how that may work, but where would I put the code [endLine.Size.Height = yourBox.Size.Height;] so that it will adjust this height on a record-by-record basis?
Thanks!
-Chuck
Hope this helps.
Ricardo
Sorry to be such a pain... I think I'm pretty close, but when I add a call to the data binding event for one of the textboxes:
this.textBox1.ItemDataBinding += new System.EventHandler(this.textBox1_ItemDataBinding);
and the following code:private void textBox1_ItemDataBinding(object sender, System.EventArgs e)
{
Line1.Size.Height = panel2.Size.Height;
}I get :
Compiler Error Message: CS1612: Cannot modify the return value of 'Telerik.Reporting.ReportItem.Size' because it is not a variable
Which is pointing to the Line1.Size.Height
* I'm attaching the report file below post...
Any ideas? -Chuck
using System.ComponentModel;
using System.Drawing;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
/// <summary>
/// Summary description for Ppr_001.
/// </summary>
public class Ppr_001 : Report
{
private DetailSection detail;
private TextBox textBox1;
private TextBox textBox2;
private TextBox textBox3;
private Panel panel2;
private TextBox PartName;
private TextBox textBox4;
private TextBox rName;
private PageHeaderSection pageHeader;
private Panel panel1;
private Shape Line1;
private Shape Line2;
private Shape shape1;
private Shape shape2;
private TextBox Col1;
private TextBox Col3;
private TextBox Col2;
private PageFooterSection pageFooter;
private int i;
public string ReportTitle
{ get { return ""; } set { this.PartName.Value = value; } }
public string PersonName
{ get { return ""; } set { this.rName.Value = value; } }
public string Column1
{ get { return ""; } set { this.Col1.Value = value; } }
public string Column2
{ get { return ""; } set { this.Col2.Value = value; } }
public string Column3
{ get { return ""; } set { this.Col3.Value = value; } }
public Ppr_001()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
//this.Line1.Size.Height = this.panel2.Size.Height;
//this.Line2.Size.Height = this.panel2.Size.Height;
}
private void textBox1_ItemDataBinding(object sender, System.EventArgs e)
{
Line1.Size.Height = panel2.Size.Height;
}
#region Component Designer generated code
/// <summary>
/// Required method for telerik Reporting designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.detail = new Telerik.Reporting.DetailSection();
this.panel2 = new Telerik.Reporting.Panel();
this.textBox1 = new Telerik.Reporting.TextBox();
this.textBox2 = new Telerik.Reporting.TextBox();
this.textBox3 = new Telerik.Reporting.TextBox();
this.Line1 = new Telerik.Reporting.Shape();
this.Line2 = new Telerik.Reporting.Shape();
this.pageFooter = new Telerik.Reporting.PageFooterSection();
this.PartName = new Telerik.Reporting.TextBox();
this.textBox4 = new Telerik.Reporting.TextBox();
this.rName = new Telerik.Reporting.TextBox();
this.pageHeader = new Telerik.Reporting.PageHeaderSection();
this.panel1 = new Telerik.Reporting.Panel();
this.shape1 = new Telerik.Reporting.Shape();
this.shape2 = new Telerik.Reporting.Shape();
this.Col1 = new Telerik.Reporting.TextBox();
this.Col3 = new Telerik.Reporting.TextBox();
this.Col2 = new Telerik.Reporting.TextBox();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// detail
//
this.detail.Height = new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.panel2});
this.detail.Name = "detail";
//
// panel2
//
this.panel2.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.textBox1,
this.textBox2,
this.textBox3,
this.Line1,
this.Line2});
this.panel2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.1666666716337204, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.panel2.Name = "panel2";
this.panel2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(9.6666669845581055, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch));
this.panel2.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
//
// textBox1
//
this.textBox1.CanGrow = true;
this.textBox1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox1.Name = "textBox1";
this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.9166667461395264, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
this.textBox1.Value = "=QuestionEvent";
this.textBox1.ItemDataBinding += new System.EventHandler(this.textBox1_ItemDataBinding);
//
// textBox2
//
this.textBox2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.1666665077209473, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox2.Name = "textBox2";
this.textBox2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1.3333333730697632, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox2.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
this.textBox2.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
this.textBox2.Value = "=AnswerChecked";
//
// textBox3
//
this.textBox3.CanGrow = true;
this.textBox3.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(5.6666665077209473, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox3.Name = "textBox3";
this.textBox3.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.9166667461395264, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox3.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
this.textBox3.Value = "=ActionTaken";
//
// Line1
//
this.Line1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.0833334922790527, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.Line1.Name = "shape1";
this.Line1.ShapeType = new Telerik.Reporting.Drawing.Shapes.LineShape(Telerik.Reporting.Drawing.Shapes.LineDirection.NS);
this.Line1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(0.083333447575569153, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch));
//
// Line2
//
this.Line2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(5.5, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.Line2.Name = "shape1";
this.Line2.ShapeType = new Telerik.Reporting.Drawing.Shapes.LineShape(Telerik.Reporting.Drawing.Shapes.LineDirection.NS);
this.Line2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(0.083333447575569153, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch));
//
// pageFooter
//
this.pageFooter.Height = new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch);
this.pageFooter.Name = "pageFooter";
//
// PartName
//
this.PartName.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.25, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch));
this.PartName.Name = "PartName";
this.PartName.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(9.5, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.PartName.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
this.PartName.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
//
// textBox4
//
this.textBox4.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox4.Name = "textBox4";
this.textBox4.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(9.8333330154418945, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.3333333432674408, Telerik.Reporting.Drawing.UnitType.Inch));
this.textBox4.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(16, Telerik.Reporting.Drawing.UnitType.Point);
this.textBox4.Style.Font.Style = System.Drawing.FontStyle.Regular;
this.textBox4.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
this.textBox4.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
this.textBox4.Value = "PDBS";
//
// rName
//
this.rName.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.83333331346511841, Telerik.Reporting.Drawing.UnitType.Inch));
this.rName.Name = "rName";
this.rName.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.75, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.rName.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
//
// pageHeader
//
this.pageHeader.Height = new Telerik.Reporting.Drawing.Unit(1.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.pageHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.rName,
this.textBox4,
this.PartName,
this.panel1});
this.pageHeader.Name = "pageHeader";
//
// panel1
//
this.panel1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.shape1,
this.shape2,
this.Col1,
this.Col3,
this.Col2});
this.panel1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.1666666716337204, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(1.1666666269302368, Telerik.Reporting.Drawing.UnitType.Inch));
this.panel1.Name = "panel1";
this.panel1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(9.6666669845581055, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.25000002980232239, Telerik.Reporting.Drawing.UnitType.Inch));
this.panel1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
//
// shape1
//
this.shape1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.0833334922790527, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.shape1.Name = "shape1";
this.shape1.ShapeType = new Telerik.Reporting.Drawing.Shapes.LineShape(Telerik.Reporting.Drawing.Shapes.LineDirection.NS);
this.shape1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(0.083333447575569153, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch));
//
// shape2
//
this.shape2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(5.5, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.shape2.Name = "shape1";
this.shape2.ShapeType = new Telerik.Reporting.Drawing.Shapes.LineShape(Telerik.Reporting.Drawing.Shapes.LineDirection.NS);
this.shape2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(0.083333447575569153, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4166666567325592, Telerik.Reporting.Drawing.UnitType.Inch));
//
// Col1
//
this.Col1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0833333358168602, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col1.Name = "Col1";
this.Col1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(3.9166667461395264, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col1.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
//
// Col3
//
this.Col3.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(5.5833334922790527, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col3.Name = "Col3";
this.Col3.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(4, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col3.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
//
// Col2
//
this.Col2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.1666665077209473, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col2.Name = "Col2";
this.Col2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1.3333333730697632, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.2395833283662796, Telerik.Reporting.Drawing.UnitType.Inch));
this.Col2.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
this.Col2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
//
// Ppr_001
//
this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.pageHeader,
this.detail,
this.pageFooter});
this.PageSettings.Landscape = true;
this.PageSettings.Margins.Bottom = new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.PageSettings.Margins.Left = new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.PageSettings.Margins.Right = new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.PageSettings.Margins.Top = new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch);
this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;
this.Style.BackgroundColor = System.Drawing.Color.White;
this.Width = new Telerik.Reporting.Drawing.Unit(10, Telerik.Reporting.Drawing.UnitType.Inch);
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
#endregion
}
Ricardo
I can't find in the documentation the list of report events.
Can you help me with the call for attaching to the report databind event?
Thanks!
-Chuck
Now go to the properties dialog and select the events (small thunder), then select the ItemDataBinding or ItemDataBound event.
That should work. If you have any trouble handling reports, refer to this: Tutorial
Hope this helps.
Ricardo
Scratch the last respones to you. I found out where to hook the event.
The problem is that at the point of ItemDataBound, the height of the panel is still the default size, it hasn't been changed. so the function:
private void detail_ItemDataBound(object sender, System.EventArgs e)
{
Line1.Height = panel2.Height;
Line2.Height = panel2.Height;
}
returns the default size of the panel, not the resized panel based on it's content...
Any ideas?
-Chuck
There is no event which you can use to adjust the size. The height of the TextBox is determined just before the item is rendered on the canvas. I'm sorry for the inconvenience but at this moment you can't achieve the desired effect.
Sincerely yours,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thanks for the head's up... guess I'll stop trying to figure it out.
And Thanks to you Ricardo for your help on this.
-Chuck
I was trying to figure out something that would help you but it seems its just not doable right now.
Ricardo
Kind regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Yes table item is available in Telerik Reporting since Q1 2009 (more than an year now). As a new user, in order to get familiar in a fast and straight-forward manner with our Reporting offering, we suggest you visit the online resources linked below:
Online examples
Online documentation
KB articles
Code library
Video Tutorials
Blog posts
Of course, you can browse the public forum as well in order to find specific information/code sample concerning an aspect of the Reporting features. There are numerous threads which can get you started/assist you through the development process.
For example a quick search in our documentation for "table" shows the relevant help articles for the item.
Regards,
Steve
the Telerik team
My issue now is that we're on version Q1 2008, as mentioned in my previous post. I'm semi stuck with this version (so I think) since most of our existing web apps use this version. We have no plans (or time) to upgrade all reports to this version. Is there a way to use different version side-by-side?
Unfortunately no. You would have to upgrade to a newer version if you want to take advantage of new report items.
Best wishes,
Steve
the Telerik team