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

dynamic report

2 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 2
Johnny asked on 01 Mar 2012, 03:56 AM
hi i create dynamic report from the follwing code
all fine the pbm is when i export the report got problem
when i export report to xls the header is totally black
if i export the reportt to csv the alignment and header is repeated
if i export to pdf the header background color missing

If HttpContext.Current.Session("DynamicReportDatas") IsNot Nothing Then
 
           Dim datas As DataTable = HttpContext.Current.Session("DynamicReportDatas")
           Me.Table1.DataSource = datas
 
           Dim textboxGroup As Telerik.Reporting.HtmlTextBox
           Dim textBoxTable As Telerik.Reporting.HtmlTextBox
           Table1.ColumnGroups.Clear()
           Table1.Body.Columns.Clear()
           Table1.Body.Rows.Clear()
           Dim ColCount As Integer = datas.Columns.Count
           For i As Integer = 0 To ColCount - 1
 
 
               Dim tableGroupColumn As New Telerik.Reporting.TableGroup()
               Table1.ColumnGroups.Add(tableGroupColumn)
               'table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
 
               textboxGroup = New Telerik.Reporting.HtmlTextBox()
               'textboxGroup.Style.BorderColor.[Default] = Color.Black
               'textboxGroup.Style.BorderStyle.[Default] = BorderType.Solid
               textboxGroup.Value = datas.Columns(i).ColumnName
               textboxGroup.Size = New SizeU(Unit.Inch(1.4), Unit.Inch(0.2))
               textboxGroup.Style.BackgroundColor = Color.FromName("#79A7E3")
               textboxGroup.Style.Font.Bold = True
               textboxGroup.Style.Font.Size = New Unit(10)
               textboxGroup.Style.VerticalAlign = VerticalAlign.Middle
               textboxGroup.Style.TextAlign = HorizontalAlign.Left
               tableGroupColumn.ReportItem = textboxGroup
 
               textBoxTable = New Telerik.Reporting.HtmlTextBox()
               'textBoxTable.Style.BorderColor.Default = Color.Black;
               'textBoxTable.Style.BorderStyle.Default = BorderType.Solid;
               textBoxTable.Value = "=Fields.[" + datas.Columns(i).ColumnName & "]"
               textBoxTable.Size = New SizeU(Unit.Inch(1.4), Unit.Inch(0.3))
               textBoxTable.Style.VerticalAlign = VerticalAlign.Middle
               textBoxTable.Style.TextAlign = HorizontalAlign.Left
 
              
 
               Table1.Body.SetCellContent(0, i, textBoxTable)
               
 
               Table1.Items.AddRange(New ReportItemBase() {textBoxTable, textboxGroup})
           Next
 
 
       End If


is there any way to create dynamic reports
cs the column name and table name is dynamic and the column count is dynamic


2 Answers, 1 is accepted

Sort by
0
Johnny
Top achievements
Rank 2
answered on 02 Mar 2012, 07:25 AM
hi i found out simple way to do the dynamic report
0
IvanY
Telerik team
answered on 02 Mar 2012, 12:42 PM
Hi Johnny,

Up to your questions:
  1. The CSV is supposed to look like that. Check our CSV Device Information Settings to change the output.
  2. Creating reports programmatically is not a trivial task. Therefore as a best practice we can recommend you to use the Designer first and create some reports. After that examine the code generated in the codebehind file - this practice can be very helpful. You can also check the Color.FromName("#79A7E3") method, as it is not properly used. Here is the MSDN help article about that. Instead you may want to use the FromArgb() method.

Regards,
IvanY
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
Johnny
Top achievements
Rank 2
Answers by
Johnny
Top achievements
Rank 2
IvanY
Telerik team
Share this question
or