Telerik Forums
Reporting Forum
2 answers
175 views
Hi,

I am using Telerik Reports with my Silverlight 4 application.  I have 2 parameters that are dependent lists (like the Country - State/Province scenario).  I don't want to force the user to have to choose either so I have selected Allow Blank for each, but when I select either at runtime, the blank options disappear so then the user would have to make a selection.  To try to get around this, I have added to each of these lists a member that says "(All)" and has a value of 0, so the user can have a report showing all the values.  I have filtered the second list to equal the Id of the first list as you described in your Cascading example but I need the "(All)" to be always available.  I could do this if the Filters had an OR option but I can only see AND.  What I am trying to achieve is the user could choose: (All countries and all States/Provinces), or (Australia and all States), or (Australia and Victoria).  How can I achieve this?

Please help.
Steve
Telerik team
 answered on 17 May 2011
3 answers
168 views
hi all.

I am doing a report and I have a subreport inside. That their report is in three columns of results, but in the report since he called me and puts a column in a new page, not the size that includes me tell you.

as can be done. Attached images.
blaise
Top achievements
Rank 1
 answered on 17 May 2011
3 answers
252 views
I have added a report and table dynamically, my dataset has 10 rows but when the report renders, it has just header, no data is rendered
I used the AutoGenerateColumns project

Here is the code

public void RenderReport()
        {
            Telerik.Reporting.Report report1 = new Telerik.Reporting.Report();
            //report1.DataSource = DataSource;

            styleRule = new Telerik.Reporting.Drawing.StyleRule();
            //Add a TypeSelector
            styleRule.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] { new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.TextBox)), new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.HtmlTextBox)) });
            //Add formatting
            styleRule.Style.Font.Name = "Courier New";
            styleRule.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Inch(.5);
            //Add rule to Style Sheet
            report1.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] { styleRule });

            table1  = new Telerik.Reporting.Table();
            table1.ColumnHeadersPrintOnEveryPage = true;
            table1.ColumnGroups.Clear();
            table1.Body.Columns.Clear();
            table1.Body.Rows.Clear();
            table1.DataSource = DataSource;
            table1.ItemDataBinding += new EventHandler(table_ItemDataBinding);

            string sortCol = "";
            string sortDir = "";
            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();
            if (ShowPageHeader)
            {
                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 });
            }
            int count = ColumnCollection.Where(p => p.ColIsVisible == true).Count();

            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();

 

            Telerik.Reporting.ReportItemBase[] groupColumnList = new Telerik.Reporting.ReportItem[GroupDescriptor.Count];
            int i = GroupDescriptor.Count;
            if (GroupDescriptor.Count > 0)
            {
                Telerik.Reporting.GroupHeaderSection groupHeaderSection1 = new Telerik.Reporting.GroupHeaderSection();
                foreach (ColumnGroupDescriptor grpDescriptor in GroupDescriptor)
                {
                    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;
                    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));
                }
            }

 

            //Detail Section
            Telerik.Reporting.DetailSection detailSection1 = new Telerik.Reporting.DetailSection();
            detailSection1.Height = new Telerik.Reporting.Drawing.Unit(2D, Telerik.Reporting.Drawing.UnitType.Inch);
            detailSection1.Items.AddRange(new ReportItemBase[] { table1 });

 

            //Page Footer Section
            Telerik.Reporting.PageFooterSection pageFooterSection1 = new Telerik.Reporting.PageFooterSection();
            if (ShowPageFooter)
            {
                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();
                if (ShowPageNumber)
                {
                    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)); //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(1, ((Telerik.Reporting.Drawing.UnitType)(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, 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(25, 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 (ExportType.ToLower() == "csv")
            {
                deviceInfo["NoHeader"] = true;
                deviceInfo["NoStaticText"] = true;
            }
            ExportType = ExportType == "rtf" ? "docx" : ExportType;
            Telerik.Reporting.Processing.ReportProcessor RP = new Telerik.Reporting.Processing.ReportProcessor();
            byte[] buffer = RP.RenderReport(ExportType.ToUpper(), report1, deviceInfo).DocumentBytes;

            string myPath = "C:";
            string file = myPath + @"\" + DateTime.Now.ToString("HHmmss") + "." + ExportType;
            FileStream fs = new FileStream(file, FileMode.Create);

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

            Process.Start(file);
        }

        void table_ItemDataBinding(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Table processingTable = (sender as Telerik.Reporting.Processing.Table);
            processingTable.DataSource = DataSource;
            int count = ColumnCollection.Where(p => p.ColIsVisible == true).Count();
            Telerik.Reporting.HtmlTextBox headerCol;
            Telerik.Reporting.TextBox textBox;

            int column = 0;
            foreach (GridViewData.columnData info in ColumnCollection)
            {
                if (info.ColIsVisible)
                {
                    TableGroup tableGroupColumn = new TableGroup();
                    table1.ColumnGroups.Add(tableGroupColumn);
                    table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2D, Telerik.Reporting.Drawing.UnitType.Inch)));

                    string columnName = info.ColHeader;
                    headerCol = CreateTxtHeader(columnName, column);
                    headerCol.Style.BackgroundColor = Color.LemonChiffon;
                    headerCol.Style.BorderStyle.Default = BorderType.Solid;
                    headerCol.Style.BorderWidth.Default = Unit.Pixel(1);
                    headerCol.Size = new SizeU(Unit.Inch(3.5), Unit.Inch(0.3));
                    tableGroupColumn.ReportItem = headerCol;

                    textBox = CreateTxtDetail(info.ColDataMemberBinding, column);
                    textBox.Style.BorderStyle.Default = BorderType.Solid;
                    textBox.Style.BorderWidth.Default = Unit.Pixel(1);
                    textBox.CanGrow = true;
                    textBox.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
                    column++;
                    table1.Body.SetCellContent(0, column, textBox);
                    table1.Items.AddRange(new ReportItemBase[] { textBox, headerCol });

                }
            }

        }

        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 = "=Fields." + FieldName + "";
            txtHead.Name = FieldName;
            txtHead.TextWrap = true;
       
            //txtHead.Dock = DockStyle.Left;
            //txtHead.CanGrow = true;
            return txtHead;
        }

    }

 

 

veena
Top achievements
Rank 1
 answered on 16 May 2011
6 answers
273 views
Is there a way to determine the required report viewer height where by there will be no vertical scrollbar. I wish to "grow" the report viewer container so the user will only need to use the browser scrollbar.

I could "guess" the height by the report pagesettings and zoom and but there must be a more elegant way.

Thanks
Mike
Top achievements
Rank 1
 answered on 16 May 2011
5 answers
186 views
Hello ,

We have a class library which contains all reports in the application.Also we have three different applications developed in Silverlight , WPF and Asp.Net website.Each report can be called used in all application.Now we want to localize all the reports based on the culture set from the application. I have gone through the link http://www.telerik.com/help/reporting/report-viewer-localization.html , but it did not help me.Also i could not found good reference material for localization.

It will be good if you can provide us the sample project which will work for all three kind of applications which includes setting a label text from resource file.

Thanks in advance.
Massimiliano Bassili
Top achievements
Rank 1
 answered on 16 May 2011
1 answer
175 views
I am trying to set a multivalue parameter of type Integer programatically with an array of int.
However, I get back an error of "Invalid value of parameter".

I have tried a number of combinations but keep encountering the error.

Where am I going wrong?
Stephan
Telerik team
 answered on 16 May 2011
1 answer
64 views
Hi,

Situation:

I have populated the fields using a datasource. One of the fields has null values. So, I have used a ItemDataBound event to populate the values from a list of values in Hashtable when the value is null. It populates alright.

Problem:

The subtotal in the GroupFooter section still gives the sum of the values which were NOT NULL initially.

Code:
private void fldAverageAnnualNLoadDataTextBox_ItemDataBound(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.TextBox tbAnnualLoad = (Telerik.Reporting.Processing.TextBox)sender;
            if (currentScenario == "Base-case")
            {
                if (!baseCaseValues.ContainsKey(currentCatchment))
                {
                    baseCaseValues.Add(currentCatchment, tbAnnualLoad.Value);
                }               
            }
 
            if (tbAnnualLoad.Value == null && currentScenario != "Base-case")
            {
                tbAnnualLoad.Value = string.Format("{0:0.0}", baseCaseValues[currentCatchment]);
            }
        }
 
Any help is highly appreciated.
Steve
Telerik team
 answered on 16 May 2011
1 answer
79 views
HI,
I am new to Telerik Reporting.I'm trying to bind a collection to the report viewer.This collection is not from a database.But from the xml. I read the xml and store them in a collection.Now i want to show whatever is in that collection as a report to the screen.How can i achieve this?
Please Help me out...
Regards
Karthik
raj
Top achievements
Rank 1
 answered on 14 May 2011
0 answers
110 views
Is Telerik Reporting 508 compliant? If it is not now, Can we expect any upcoming releases with 508 compliant reporting? We are looking for a 508 compliant reporting tool. Thanks!
MA
Top achievements
Rank 1
 asked on 13 May 2011
3 answers
102 views
Hi there,

I create a report and want to set the DocumentMapVisible to false in my Silverlight application.
But there is no property availabe, not in XAML and also not in code behind.

Any hint?

Best Regards
Manfred
Peter
Telerik team
 answered on 13 May 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?