Telerik Forums
Reporting Forum
1 answer
122 views
For some reason the Table Wizard is not present in the Telerik Reporting toolbox (nor any other wizards).

I'm working in VS 2005 - with Telerik Reporting 2011 Q1

Is there any way to start the Wizard without doing a drag-and-drop from the Toolbox?
It don't have admin priviledges on my computer so I have limited flexibility...

Thanks in advance for any help with this!

 - Pascal
Aaron
Top achievements
Rank 1
 answered on 20 Apr 2011
1 answer
150 views
I am experimenting with creating a multi-column report that includes a group with a header; I have set the KeepTogether property (seems to be meant for pages, not columns, but have tried anyway) to true, but the groups may still span multiple columns.  That creates the situation where the group header is, say, on the bottom of the left column (2 column report) and the details, sans a header, are on the top of the right column.

Is there any way to prevent the group from spanning multiple columns?  That is, essentially make the KeepTogether behave on columns as it does on pages?

Thanks,
Adam 
Steve
Telerik team
 answered on 20 Apr 2011
3 answers
329 views
Hi,
I'm facing a problem in programmatically creating a table. I have managed to add columns to table and the report renders fine,using this thread

:http://www.telerik.com/community/forums/reporting/telerik-reporting/quot-dynamic-quot-table-in-telerik-reports.aspx

How can i now add summations for particular column in the end of the table(the last row) programmatically?

For instance, I would only like to show summations for some of the columns,not all of them becouse some of them are not summable...

Thanks in advanace
Massimiliano Bassili
Top achievements
Rank 1
 answered on 20 Apr 2011
1 answer
205 views
Hello,

I am attempting to manually create a report in the viewmodel to bind to a WPF reportviewer control.

I cannot use the designer as I have to create the table manually. The report will accept a datasource object (in this instance a List<T> where T is a domain object), create the columns, and then populate the rows. I have done extensive research on the forums and created the column collection and even the entire table. I am unable to get it to show anything once the report is bound to the view.

Any help is appreciated.

-Josh

Here is the xaml for the report viewer:

 

 

 

<telerikReporting:ReportViewer Grid.Row="1" x:Name="ReportViewer1" Report="{Binding DataContext.AutoReport}" Width="500" Height="600" >

 

</telerikReporting:ReportViewer>


And here is the ViewModel:

 

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using System.Collections;
  
namespace Client.ViewModels
{
   public class TelerikDummyReportViewModel : ReportViewModelBase
    {
        public TelerikDummyReportViewModel(ContentViewModelBase parent) : base(parent)
        {
              
        }
        #region Properties
  
         
  
       private Report _autoreport;
       public Report AutoReport
       {
           get
           {
               return _autoreport;
           }
           set
           {
               // Check if it's really a change 
               if (value == _autoreport)
                   return;
  
               // Change Report 
               _autoreport = value;
  
               // Notify attached View(s) 
               RaisePropertyChanged("AutoReport");
           }
       
       private List<user> _userDataList;
        public List<user> UserDataList 
        
            get { return _userDataList; } 
            set
            {
                _userDataList = value;
                if (_userDataList.Count() > 0)
                {
                    AutoReport = new DynamicReport(_userDataList[0]);
                    AutoReport.Report.DataSource = UserDataList;
  
                }
                RaisePropertyChanged("UserDataList");
                RaisePropertyChanged("AutoReport");
            
        }
          
  
        #endregion
        internal override void ControlLoaded()
        {
            DependencyCheck();
        }
  
        internal override void DependencyCheck()
        {
              
            GetUsers();
        }
        public void GetUsers()
        {
            ShowIsBusyMessage("Loading ...");
            AuthenticationClient.GetLPUsersCompleted += new EventHandler<GetLPUsersCompletedEventArgs>(AuthenticationClient_GetLPUsersCompleted);
            AuthenticationClient.GetLPUsersAsync();
              
        }
  
        void AuthenticationClient_GetLPUsersCompleted(object sender, GetLPUsersCompletedEventArgs e)
        {
            AuthenticationClient.GetLPUsersCompleted -= AuthenticationClient_GetLPUsersCompleted;
            if (e.Error != null)
            {
                this.HandlePrompt("Error retrieving audit activity filter.", DisplayName, e.Error);
                HideIsBusyMessage();
            }
            else if (e.Result != null)
            {
                UserDataList = e.Result.ToList();
            }
            HideIsBusyMessage();
        }
  
  
     
       internal class DynamicReport : Telerik.Reporting.Report
       {
           private Table table1;
           public DynamicReport(object sourceObject)
           {
               table1 = createTable(sourceObject);
  
           }
  
  
           private Table createTable(object sourceObject)
           {
               var targetTable = new Table();
               targetTable.ColumnGroups.Clear();
               targetTable.Body.Columns.Clear();
               targetTable.Body.Rows.Clear();
  
               var sourcePropertyList = sourceObject.GetType().GetProperties();
               Telerik.Reporting.TextBox textboxGroup;
               Telerik.Reporting.TextBox textBoxTable;
               Telerik.Reporting.TableGroup tableGroupColumn;
               int i = 0;
               foreach (var o in sourcePropertyList)
               {
                   tableGroupColumn = new TableGroup();
  
                   targetTable.Body.Columns.Add(new TableBodyColumn(Unit.Inch(1)));
  
                   textboxGroup = new Telerik.Reporting.TextBox();
                   textboxGroup.Value = o.Name;
                   textboxGroup.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
                   tableGroupColumn.ReportItem = textboxGroup;
                   targetTable.ColumnGroups.Add(tableGroupColumn);
  
                   textBoxTable = new Telerik.Reporting.TextBox();
                   targetTable.Body.SetCellContent(0, i++, textBoxTable);
                   textBoxTable.Value = "=Fields." + o.Name;
               }
               TableGroup tableGroupRow = new TableGroup();
               targetTable.RowGroups.Add(tableGroupRow);
               tableGroupRow.Grouping.Add(new Telerik.Reporting.Data.Grouping());
               targetTable.DataSource = sourceObject;
               return targetTable;
           }
       }
          
    }
}
Steve
Telerik team
 answered on 20 Apr 2011
3 answers
247 views
How could I invoke Export button event handler programmaticlly? I need to doing something when user click the export button in the report viewer bar. Could I do it on the server side?

thanks alot
Kevin
Steve
Telerik team
 answered on 20 Apr 2011
2 answers
73 views
Hi ,

one of my client is using default blue skin for a bar chart , i have changed the bar chart to their requirement in terms of style ,

what we need to know is how we can add a new skin in addition to the list of skin that has been provided be default,

please let me know on this , thanks in advance .

Ashok

Steve
Telerik team
 answered on 20 Apr 2011
1 answer
55 views
Hi,


I am creating a telerik report and loading filters (controls) dynamically based on the selection of another control. The problem I am having is that as soon as I make the selection all the filter controls disappear. Please see the screen shot attached here. I get no errors so it is very hard to tell what I'm doing wrong.


How do I correct that?
Steve
Telerik team
 answered on 19 Apr 2011
1 answer
42 views
I am finding it strange. After designing a cross tab using telerik reporting, the data coming from the database that's supposed to appear on top (column names) are numeric (int) e.g 1,2,3,4 etc.
What happens is that the heading disappears completely.
When i convert the data into varchar, or nvarchar, they appear.

How do i make a telerik crosstab report header/column name 'numeric'?
Secondly, is there a way to sort the headers/column names so that they appear like 1,2,3,4 etc?

I appreciate your help.
Steve
Telerik team
 answered on 19 Apr 2011
1 answer
665 views
I wrote this process to build completely dynamic report based on data which is set of IEnumerable class data from entity framework. it works perfect but I want to render detail section in table, I get empty table. Tried alot but couldn't figure it out.

I could sort and group on multi column, excluded filter since that is done during data fetch. And it is for export only so we don't worry about page size, but if you want to print, use 9 intead of 22 inch as its width.

PS: I don't want to use any report template to start with.

public

 

 

static void GenerateReport(Telerik.ReportViewer.Wpf.ReportViewer rv, IEnumerable<object> data, string extension, SortDescriptorCollection sortDescriptors, GroupDescriptorCollection grpDescriptors

 

 

 

{

 

 

 

Telerik.Reporting.

 

Report report1 = new Telerik.Reporting.Report();

 

report1.DataSource = data;

 

string sortCol = "";

 

string sortDir = "";


 //multi sort can be done by iterating through collection like for group

 

if (sortDescriptors.Count > 0)

{

 

ColumnSortDescriptor sd = sortDescriptors[0] as ColumnSortDescriptor;

sortCol = sd.Column.UniqueName;

sortDir = sd.SortDirection.ToString();

}

 

//Page Header Section

 

 

 

Telerik.Reporting.

 

PageHeaderSection pageHeaderSection1 = new Telerik.Reporting.PageHeaderSection();

 

pageHeaderSection1.Height = 

 

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType

.Inch);

pageHeaderSection1.Style.BackgroundColor = 

 

Color.Gray;

 

Telerik.Reporting.

 

TextBox txtHead = new Telerik.Reporting.TextBox();

 

txtHead.Value = 

 

"Title";

 

 

 

txtHead.Location = 

 

 

new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(3.2395832538604736D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505D, Telerik.Reporting.Drawing.UnitType.Inch));

 

 txtHead.Name = 

 

"reportTitle";

 

 

 

txtHead.Size = 

 

 

new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5603775978088379D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType.Inch));

pageHeaderSection1.Items.AddRange(

 

new Telerik.Reporting.ReportItemBase[] { txtHead });

 

 

 

IEnumerator dataColl = data.GetEnumerator();

 

int count = 0;

 

 

int

first = 0;

 

 

 

 

object obj = null;

 

 

while (dataColl.MoveNext())

 

 

if (first == 0) 

 

 

{

 

 

 

obj = dataColl.Current;

 

 

 

 

 

foreach (PropertyInfo info in

obj.GetType().GetProperties())

 

{

 count++;

 }

 first++;

 }

}

 

Telerik.Reporting.Drawing. 

 

Unit x = Telerik.Reporting.Drawing.Unit.Inch(0);

 

 

Telerik.Reporting.Drawing.

 

Unit y = Telerik.Reporting.Drawing.Unit.Inch(0);

 

 

Telerik.Reporting.

 

ReportItemBase[] headColumnList = new Telerik.Reporting.ReportItem[count];

 

 

Telerik.Reporting.

 

ReportItemBase[] detailColumnList = new Telerik.Reporting.ReportItem[count];

 

 

Telerik.Reporting.

 

Group group = new Telerik.Reporting.Group();

 

 

 

 

 

 

SizeU size = new SizeU(Telerik.Reporting.Drawing.Unit.Inch((double)(22) / count), Telerik.Reporting.Drawing.Unit.Inch(0.6));

 

 

 

int column = 0;


 

foreach (PropertyInfo info in obj.GetType().GetProperties())  

 

 

{

 

 

 

string columnName = info.Name;

Telerik.Reporting.

 

HtmlTextBox headerCol = CreateTxtHeader(columnName, column);

 

headerCol.Style.BackgroundColor = 

 

Color.LemonChiffon;

 

headerCol.Style.BorderStyle.Default = 

 

BorderType.Solid;

 

headerCol.Style.BorderWidth.Default = 

 

Unit.Pixel(1);

 

headerCol.CanGrow = true;

headerCol.Location = 

 

new Telerik.Reporting.Drawing.PointU(x, y);

 

headerCol.Size = size;

headColumnList[column] = headerCol;

 

 

Telerik.Reporting.

 

TextBox textBox = CreateTxtDetail(columnName, column);

 

textBox.Style.BorderStyle.Default = 

 

BorderType.Solid;

 

textBox.Style.BorderWidth.Default = Unit.Pixel(1);
textBox.CanGrow = true;
textBox.Location = new Telerik.Reporting.Drawing.PointU(x, y);

textBox.Size = size;

 

detailColumnList[column] = textBox;

textBox.ItemDataBinding += 

 

new EventHandler(textBox_ItemDataBound);

 

 

x += Telerik.Reporting.Drawing.

 

Unit.Inch(headerCol.Size.Width.Value);

 

column++;

 

}

 

Telerik.Reporting.

 

ReportItemBase[] groupColumnList = new Telerik.Reporting.ReportItem[grpDescriptors.Count];

 

 

 

 

int i = grpDescriptors.Count;

 

 

 

if (grpDescriptors.Count > 0)

{

 

Telerik.Reporting.

 

GroupHeaderSection groupHeaderSection1 = new Telerik.Reporting.GroupHeaderSection();

 

 

foreach (ColumnGroupDescriptor grpDescriptor in grpDescriptors)

{

 

 

 

string grpCol = grpDescriptor.Column.UniqueName;

group.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields." + grpCol));

 

if (grpDescriptor.SortDirection.ToString().ToLower() == "descending")

{

group.Sortings.Add(

 

new Telerik.Reporting.Data.Sorting("=Fields." + grpCol, Telerik.Reporting.Data.SortDirection.Desc));

 

}

 

else

 

 

 

{

group.Sortings.Add(

 

new Telerik.Reporting.Data.Sorting("=Fields." + grpCol, Telerik.Reporting.Data.SortDirection

.Asc));}

 

 

 

 

i--;

 

 

 

Telerik.Reporting.

 

TextBox hdCol = new Telerik.Reporting.TextBox();

 

 

 

hdCol.Style.BackgroundColor = 

 

Color.Orange;

 

hdCol.Style.BorderStyle.Default = BorderType.Solid;
hdCol.Style.BorderWidth.Default = Unit.Pixel(1);

hdCol.KeepTogether = 

 

true;

 

hdCol.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5603775978088379D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType

.Inch));

hdCol.Value = 

 

"=[" + grpCol + "]"; ;

 

 

groupColumnList[i] = hdCol;

group.GroupHeader = groupHeaderSection1;
//to avoid extra row after group col
group.GroupHeader.Height = Telerik.Reporting.Drawing.

 

Unit.Inch(0);

 

}

 

groupHeaderSection1.Items.AddRange(groupColumnList); 

}

 

 

 

 

 

if

(sortCol.Length > 0)

{

group.Groupings.Add(

 

new Telerik.Reporting.Data.Grouping("=Fields." + sortCol));

 

 

if (sortDir.ToLower() == "descending")

{

group.Sortings.Add(

 

new Telerik.Reporting.Data.Sorting("=Fields." + sortCol, Telerik.Reporting.Data.SortDirection.Desc));

 

}

 

else

 

{

group.Sortings.Add(

 

new Telerik.Reporting.Data.Sorting("=Fields." + sortCol, Telerik.Reporting.Data.SortDirection.Asc));

 

}

 

}

 

 

ReportHeaderSection reportHeaderSection1 = new Telerik.Reporting.ReportHeaderSection();

reportHeaderSection1.Height = 

 

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType

.Inch);

reportHeaderSection1.Items.AddRange(headColumnList);

report1.Groups.Add(group);

 

 

//Detail Section

 

 

Telerik.Reporting.

 

DetailSection detailSection1 = new Telerik.Reporting.DetailSection();

detailSection1.Height = 

 

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType

.Inch);

detailSection1.Items.AddRange(detailColumnList);

 

 

 

//Page Footer Section

 

 

Telerik.Reporting.

 

PageFooterSection pageFooterSection1 = new Telerik.Reporting.PageFooterSection();

 

pageFooterSection1.Height = 

 

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType

.Inch);

pageFooterSection1.Style.BackgroundColor = 

 

Color.LightGray;

 

 

pageFooterSection1.PrintOnFirstPage = 

 

true;

 

pageFooterSection1.PrintOnLastPage = 

 

true;

 

Telerik.Reporting.TextBox txtFooter = new Telerik.Reporting.TextBox();

txtFooter.Value = 

 

"='Page ' + PageNumber + ' of ' + PageCount";

 

txtFooter.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.2395832538604736D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505D, Telerik.Reporting.Drawing.UnitType.Inch));

txtFooter.Name = 

 

"pageInfoTextBox";

 

txtFooter.Size = 

 

new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5603775978088379D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType.Inch)); Telerik.Reporting.PictureBox picBoxFooter = new Telerik.Reporting.PictureBox();  

 

 

picBoxFooter.Location = 

 

new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(5.2395832538604736D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505D, Telerik.Reporting.Drawing.UnitType.Inch));

 

 

 

picBoxFooter.Value = 

 

@"C:\CCMSGoldStandard_Local\CCMSGoldStandard\CCMSAppShell\Images\no.png";

 

 

 picBoxFooter.Style.TextAlign = Telerik.Reporting.Drawing.

 

HorizontalAlign.Center;

 

 

 

picBoxFooter.Size = 

 

new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Inch))), new Telerik.Reporting.Drawing.Unit(.5D, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Inch))));

 

 

 

picBoxFooter.Sizing = 

 

ImageSizeMode.AutoSize;

 

 

 pageFooterSection1.Items.AddRange(

 

new Telerik.Reporting.ReportItemBase[] { txtFooter, picBoxFooter });

 

 

 

//add all section to report

report1.Items.AddRange(

 

new Telerik.Reporting.ReportItemBase[] { pageHeaderSection1, reportHeaderSection1, detailSection1, pageFooterSection1 });

 

 

 

report1.PageSettings.Landscape = 

 

false;

 

report1.PageSettings.Margins.Bottom = 

 

new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

 

report1.PageSettings.Margins.Left = 

 

new Telerik.Reporting.Drawing.Unit(.25, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

 

report1.PageSettings.Margins.Right = 

 

new Telerik.Reporting.Drawing.Unit(.25, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

 

report1.PageSettings.Margins.Top = 

 

new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

 

Telerik.Reporting.Drawing.

 

SizeU paperSize = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(22, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(22, Telerik.Reporting.Drawing.UnitType.Inch));

 

report1.PageSettings.PaperSize = paperSize;

report1.PageSettings.PaperKind = System.Drawing.Printing.

 

PaperKind.Custom;

 

 

 

Hashtable deviceInfo = new Hashtable();

deviceInfo["FontEmbedding"] = "Subset";

 

if (extension.ToLower() == "csv"

)

{

deviceInfo[

 

"NoHeader"] = true;

 

deviceInfo["NoStaticText"] = true;

}

 

Telerik.Reporting.Processing.

 

ReportProcessor RP = new Telerik.Reporting.Processing.ReportProcessor();

 

 

 

 

 

 

 

byte [] buffer = RP.RenderReport(extension.ToUpper(), report1, deviceInfo).DocumentBytes;

 

string myPath = "C:";

 

string file = myPath + @"\" + DateTime.Now.ToString("HHmmss") + "." + extension;

 

 

FileStream fs = new FileStream(file, FileMode.Create);

fs.Write(buffer, 0, buffer.Length);

fs.Flush();

fs.Close();

 

 

 

 

 

Process.Start(file);

 

 

 

 

 

 

}

 

 

 

 

 

static void textBox_ItemDataBound(object sender, EventArgs e)

{

 

if (((Telerik.Reporting.Processing.TextBox)sender).Value == null || (((Telerik.Reporting.Processing.TextBox)sender).Value.ToString() == ""

))

{

((Telerik.Reporting.Processing.

 

TextBox)sender).Value = "";

 

}

 

}

 

 

 

 

 

 

 

public static Telerik.Reporting.HtmlTextBox CreateTxtHeader(string FieldName, int i)

{

Telerik.Reporting.

 

HtmlTextBox txtHead = new Telerik.Reporting.HtmlTextBox();

 

txtHead.Value = FieldName;

 

 

return txtHead;

 

}

 

 

 

 

 

public static Telerik.Reporting.HtmlTextBox CreateHTMLTxtDetail(string FieldName, int i)

{

Telerik.Reporting.

 

HtmlTextBox txtHead = new Telerik.Reporting.HtmlTextBox();

 

txtHead.Value = "=[" + FieldName + "]";

 

//txtHead.Dock = DockStyle.Left;

//txtHead.Name = FieldName;  

 

 

 

txtHead.CanGrow = true;

 

return txtHead;

}

 

 

 

 

 

public static Telerik.Reporting.TextBox CreateTxtDetail(string FieldName, int i)

{

 

Telerik.Reporting.

 

TextBox txtHead = new Telerik.Reporting.TextBox();

 

txtHead.Value = "=[" + FieldName + "]";

txtHead.Name = FieldName;

 

//txtHead.Dock = DockStyle.Left;

//txtHead.CanGrow = true;

return txtHead;

 

 

}

 

Steve
Telerik team
 answered on 19 Apr 2011
4 answers
109 views
Hello, Telerik,

I use telerik reporting, after i set up the Detail Section background image

it's not show on the reporting page,

but after i save as pdf file it is appeared

i use style->backgroundimage->imagedata->then give a "jpg" file from the Resources 

it's WPF reportviewer

please give me an answer and how to fix the problem? thank you

Peter
Telerik team
 answered on 19 Apr 2011
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?