Telerik Forums
Reporting Forum
2 answers
74 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
64 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
45 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
674 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
113 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
1 answer
447 views
trying to install Telerik Reporting Q1 2011.

And according to the popup when I try to install Net Framework 2.0 since it came as a part of my OS.

How do I manage to install the trial?
Stian
Top achievements
Rank 1
 answered on 19 Apr 2011
1 answer
119 views
Hi,

I developed a report, if I click on the print button on the tool bar, the size of the document is quite big (as I can see from the data been transferred to the printer).

For example, a 1 page report with corsstab, if I exported as a PDF file, it is 167KB, if I directly print it by clicking the print button, it is over 2MB. It seems to me it is sending the report as an image? Even 167KB is still seem quite large for a 1 page report. The worst case is a 160 pages report, when print it by clicking on the print button, the total data size is 16.1GB...

Can someone help with explaining this? It is urgent.

Thank you in advance.

VH

VH
Top achievements
Rank 1
 answered on 19 Apr 2011
1 answer
295 views
Hello
I am working in WPF and have attempted to build a "hello world" report.  i created a simple report using the wizard - no problem.  Then i added a reportviewer to the main xaml page and gave it the name "viewer". 

The xaml is as follows:

 

 

 

<tr:ReportViewer Name="viewer"/>

 



The namepaces that the control added to the page were:

xmlns

 

 

:telerik="http://schemas.telerik.com/2008/xaml/presentation"

 

 

 

 

xmlns:tr="http://schemas.telerik.com/wpf" x:Class="WpfApplication2.MainWindow"

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

I am getting the error:

 


Could not load type 'Telerik.Reporting.OpenXmlRendering.Presentation.PresentationReport' from assembly
'Telerik.Reporting, Version=5.0.11.316, Culture=neutral, PublicKeyToken=a9d7983dfcc261be'.

References added are:

Telerik.Reporting
Telerik.Reporting.OpenXmlRendering
Telerik.Reporting.Service
Telerik.ReportViewer.Wpf
Telerik.Windows.Controls
Telerik.Windows.Controls.Input
Telerik.WIndows.Controls.Navigation
Telerik.WIndows.Data

Target Framework is .Net Framework 4 (not client)
I am working with Reporting Q1 2011 and RadControls for WPF Q1 2011

The page will not load with the report viewer on it.  It crashes in the InitializeComponent() call of the page.

Of course, the page runs fine if i remove the reportviewer control.

When i search the class view for Presentation.PresentationReport there are no hits, so this file is not anywhere in the references.  What am i missing?

any ideas please?  I always do a very simple test application before moving forward.  I would really like to have this tool work, so i can avoid going back to SSRS for reporitng.

Pam



Steve
Telerik team
 answered on 18 Apr 2011
3 answers
299 views
Hi Telerik,
     I have a Silverlight Report Viewer which uses NeedDataSource to generate vaule for TextBox and bind DataSource of several tables in the report. When viewing the report in Silverlight viewer, all data have been populated correctly. However, the exported PDF (or other format) won't have value in the TextBoxes, but the data in the tables are displayed correctly.

This is how I assign values to TextBox and table's DataSource.
fullName.Value = p.FullName;
educationTable.DataSource = eduList;











The first value is assigned in the Report Viewer but not in exported PDF. The second line works fine in
both Report Viewer and exported PDF.

Do you know if I might miss anything?

Thanks,
Karlkim

Steve
Telerik team
 answered on 18 Apr 2011
4 answers
86 views
I use OA as my datasource quite a bit and thus use NeedsDataSource about 99% of the time.  So I lose all designtime access to show me the Fields Available (the OA DS doesn't always fill the need)

Could you provide some way for me to expose the fields?  Perhaps override or implement an interface somewhere in the code where the designer would get me back those field names that I manually define?

Steve
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 18 Apr 2011
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?