Telerik Forums
Reporting Forum
1 answer
122 views

Hi, 

I am generating a table dynamically but after generate it to .DOCX file I notice that the table is split into several tables, depending on the length of the table and the size of the page.

¿There is any way to keep the table as just one table? ... although the table is not seen in its entirety?

Thanks

Francisco

Katia
Telerik team
 answered on 15 May 2017
4 answers
819 views

Hi!

In my solution all reports are created with the ReportDesigner and saved as external .trdx files. The files reside at runtime in a common server-directory available to all workplaces. The "path-to-reports" is in the app.config of the main exe and it is no problem to load these .trdx file with a generic method using the ReportXmlSerializer. But two problems occur:

First, the ReportViewer (WPF, version Q1/2015) tries to load all subreports from the \bin\Debug directory of the main exe file, not from the directory where the main report is in. There is no "SubReports" collection in the report itself, instead I have to recursively search all Items for an object of type SubReport and set the "path-to-reports" which is very annoying. Is there another solution?

Second, the above also applies to external Stylesheets which are located in a subdirectory of the reports directory.

Regards
Neils

Trent
Top achievements
Rank 1
 answered on 13 May 2017
1 answer
516 views

Hi!  We are trying to create a report which will let our application print data to an Avery 5066 sheet of labels.  What is the best way to do this?  Can we use the Label Report Wizard?

We've been so far unsuccessful using standard reports - the spacing doesn't line up from label to label.

Thank you,

- Aaron

Stef
Telerik team
 answered on 12 May 2017
5 answers
1.7K+ views
Hi,

I come across out of memory expetion in my application.I'm not using large amount of data.
Scenario:
I have application that need to print draw for martial art fights. There are over 100 categories and each category is on 1 page (up to 32 players) and on more then 1 if there are more then 32 players in category. Each category has its own report. Report is basicly manualy drawn draw (textboxes and lines). For example for 32 players draw I have 160 texboxes and each ot them has 2 or 3 conditinal formating and 2 of those conditional formating is also using backgroung image (images are taken from global::resource and not from report). When I render each report one by one everthing is fine. Problem comes when I need to create PDF with all drawns in it (100+pages).
I use ReportBook and in foreach statement I'm adding report to ReportBook. After that foreach statement I have this code but application does not  come to that part.
ReportProcessor reportProcessor = new ReportProcessor( );
 
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource( );
 
var reportToExport = reportBook;
instanceReportSource.ReportDocument =reportToExport;
 
RenderingResult result = reportProcessor.RenderReport( "PDF", instanceReportSource, null );
string fileName = result.DocumentName + "." + result.Extension;
 
Response.Clear( );
Response.ContentType = result.MimeType;
Response.Cache.SetCacheability( HttpCacheability.Private );
Response.Expires = -1;
Response.Buffer = true;
 
Response.AddHeader( "Content-Disposition", string.Format( "{0};FileName=\"{1}\"", "attachment", fileName ) );
 
Response.BinaryWrite( result.DocumentBytes );
Response.End( );

Is there any way that I actualy render 1 report at time and then just glue them in 1 PDF (like I create 100+ individual reports and then save them all in 1 PDF).
When I watch for memory, this PDF creating takes from 200MB memory up to 2,6 GB and then gives me "parameter is null" error on screen but when I debug application details says "out of memory". There is still more phisical memory free on server. I dont know what is taeking 2,6 GB of memory and final result is 300 kb PDF.

Please help.

Stef
Telerik team
 answered on 12 May 2017
1 answer
600 views

Hey there, 

I am trying to get the list of distinct values from a parameter which is of multivalue select.. Here is the exact scenario:

I have filter on my report table which takes a multivalue parameter.. This parameter is directly bound to one of the columns in report datasource.  Now I need to access these multivalue parameter list outside of my table( in footer). The problem started when I attempted to get the distinct list of values in that parameter.. 

I could simply use =Join (", ",=Parameters.MyParam1.Value) which would concatenate all the values, but since the filter is directly bound to the report's data source, it returns duplicate values.

For example, when I set the value for MyParam1 to 'Gold', 'Silver', the parameter holds duplicate number of values depending upon number of rows in the report table.. 

How can I get around this to get the distinct values from MyParam1?

Stef
Telerik team
 answered on 12 May 2017
5 answers
148 views
See the attached file to see how it looks.
Stef
Telerik team
 answered on 12 May 2017
1 answer
1.5K+ views

Hello,

We have old project where we had used Crystal Report as Reporting Tool. We are working on Asp.Net MVC project now and we are using Telerik Reporting in it. 

Issue is that i am suppose to give the same look to the telerik reports as Crystal Reports which i am not able to achieve in some sections.

for instance i have attached 3 images one that displays the Crystal Report and other of Telerik Report. In Crystal Report the Height of the Details section gets set automatically no matter how many rows the the data source has,Height of the details section will be the same if we have 2 rows in data source or 10 rows in datasource to display.

In telerik this is not the case, the height of the details section gets set based on the numbers of rows that data source has. if i have only two rows to display then the height of the details will be set as per that and if i have 10 rows then height will be incremented accordingly.

as you can see in the image of Crystal Report which i uploaded, the details section is of fixed height and it has borders, i want to achieve same look in telerik, i can set the borders of Details section but if data source has less data then it will display small details section and then there will be white space and then the footer section.(i want the footer section to display at the bottom only, i have set PrintAtBottom property true). If i increase the height of details section then there will be white space area between two details items (check image 3). Is there any way i can achieve this look in Telerik where i can set the height of Details section and not having extra white space?

 

Regards,

Savan K. Parmar

Katia
Telerik team
 answered on 11 May 2017
1 answer
885 views

Hi, 

I am trying to create a report that includes a table dynamically generated, I will not use the viewer control, just I would like to generate the table from a DataTable but after compose the with the method "GenerateTable" and save the file I always get the error "An error has occurred while processing Table 'xxxx':
Table Body has 2 rows but 0 are expected"

What is wrong?, any help would be appreciated.

namespace ReportLibrary
{
    partial class GenericReport
    {
        #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()
        {
            Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
            this.pageHeaderSection1 = new Telerik.Reporting.PageHeaderSection();
            this.detail = new Telerik.Reporting.DetailSection();
            this.pageFooterSection1 = new Telerik.Reporting.PageFooterSection();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            //
            // pageHeaderSection1
            //
            this.pageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(1D);
            this.pageHeaderSection1.Name = "pageHeaderSection1";
            //
            // detail
            //
            this.detail.Height = Telerik.Reporting.Drawing.Unit.Inch(2D);
            this.detail.Name = "detail";
            //
            // pageFooterSection1
            //
            this.pageFooterSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(1D);
            this.pageFooterSection1.Name = "pageFooterSection1";
            //
            // GenericReport
            //
            this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.pageHeaderSection1,
            this.detail,
            this.pageFooterSection1});
            this.Name = "GenericReport";
            this.PageSettings.Margins = new Telerik.Reporting.Drawing.MarginsU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D));
            this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;
            styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.TextItemBase)),
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.HtmlTextBox))});
            styleRule1.Style.Padding.Left = Telerik.Reporting.Drawing.Unit.Point(2D);
            styleRule1.Style.Padding.Right = Telerik.Reporting.Drawing.Unit.Point(2D);
            this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {
            styleRule1});
            this.Width = Telerik.Reporting.Drawing.Unit.Inch(6.125D);
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
 
        }
        #endregion
 
        private Telerik.Reporting.PageHeaderSection pageHeaderSection1;
        private Telerik.Reporting.DetailSection detail;
        private Telerik.Reporting.PageFooterSection pageFooterSection1;
    }
}

 

 

namespace ReportLibrary
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;
 
    /// <summary>
    /// Summary description for GenericReport
    /// </summary>
    public partial class GenericReport : Telerik.Reporting.Report
    {
        private DataSet dataSet;
 
        public GenericReport(DataSet dataSet)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();           
 
            //
            // TODO: Add any constructor code after InitializeComponent call
            //    
 
            foreach (DataTable dataTable in dataSet.Tables)
            {
                Telerik.Reporting.Table table = null;
                table  = GenerateTable(dataTable);
                this.detail.Items.Add(table);                  
            }                  
        }
 
        private Telerik.Reporting.Table GenerateTable(DataTable dataTable)
        {
            Telerik.Reporting.Table table = new Table();
            table.Name = dataTable.TableName;
             
            //Create columns
            int counterColumn = 0;
            foreach (System.Data.DataColumn column in dataTable.Columns)
            {
                //Add column
                table.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(1D)));            
                 
                //Create group to include column
                Telerik.Reporting.TableGroup tmpTableGroup = new Telerik.Reporting.TableGroup();
                tmpTableGroup.Name = "tableGroup" + counterColumn;
                 
                //Column textBox
                Telerik.Reporting.TextBox tmpTextBox = new Telerik.Reporting.TextBox();
                tmpTextBox.Name = column.ColumnName;
                tmpTextBox.Value = column.ColumnName;
 
                tmpTableGroup.ReportItem = tmpTextBox;
                table.ColumnGroups.Add(tmpTableGroup);
 
                table.Items.Add(tmpTextBox);
 
                counterColumn++;
            }
 
            //Create rows
            int counterRow = 0;
            foreach (System.Data.DataRow row in dataTable.Rows)
            {               
                table.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(Unit.Pixel(50)));
 
                for (int i = 0; i < dataTable.Columns.Count; i++)
                {
                    Telerik.Reporting.TextBox tmpTextBox = new Telerik.Reporting.TextBox();
                    tmpTextBox.Name = "dd";
                    tmpTextBox.Value = row.ItemArray[i].ToString();
                    tmpTextBox.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D));
 
                    table.Body.SetCellContent(counterRow, i, tmpTextBox);                  
                    table.Items.Add(tmpTextBox);
                }
 
                counterRow++;
            }
             
            table.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.20000000298023224D), Telerik.Reporting.Drawing.Unit.Inch(0.30000001192092896D));
                        
            return table;
        }
                      
    }
}

 

FMorales
Top achievements
Rank 1
 answered on 11 May 2017
2 answers
191 views

Hi,

I have report which dynamically create a htmltextbox. Upon exporting to Excel via Report Viewer, the htmltextbox where merge. Is it possible to set it to nowrap and not merge programatically?.  (Please see Attachment.) 

I tried to set  can grow to false/true but no luck.

Appreciate your help.

Thank you.

private Telerik.Reporting.HtmlTextBox CreateTxtHeader(string FieldName, double swidth, double PosX, double PosY, bool isBold)
    {
        Telerik.Reporting.HtmlTextBox txtHead = new Telerik.Reporting.HtmlTextBox();
        txtHead.Size = new Telerik.Reporting.Drawing.SizeU(Unit.Inch(swidth), Telerik.Reporting.Drawing.Unit.Inch(0.3));
        txtHead.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(PosX), Telerik.Reporting.Drawing.Unit.Inch(PosY));
        txtHead.Style.BorderStyle.Default = BorderType.None;
        txtHead.Style.Font.Bold = isBold;
        txtHead.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(intScale);
        txtHead.Style.Font.Name = "Arial";
        txtHead.Style.TextAlign = HorizontalAlign.Left;
        txtHead.Style.VerticalAlign = VerticalAlign.Middle;
        txtHead.StyleName = FieldName;
        txtHead.Value = FieldName;
        txtHead.CanGrow = true;
        return txtHead;
    }

 

-Im using Telerik Reporting Q3 2015 9.2.15.930

Von Aaron
Top achievements
Rank 2
 answered on 11 May 2017
2 answers
186 views

Hi,

I need to modify, when loading, a picturebox value from a report generated in TRDX and kept in a DB.

I know that's maybe because my knowlage is limitated... but after several tries and too many hours searching I can't find the correct way. Anyone can help??

I'm develloping in asp.net webforms, c#, VS2013.

Here'a a code snippet of my question:

 

XmlReportSource mapa = new XmlReportSource();
string xml = dal.LeMapa(connection, Session["Report"].ToString());
mapa.Xml = xml.Replace("DBDev",connection);
mapa.Parameters.Add("Sigla", Session["Sigla"].ToString());
ReportViewer.ReportSource = mapa;

XmlReportSource instanceReportSource = (XmlReportSource)this.ReportViewer.ReportSource;
Report report = (Report)instanceReportSource.ToString();
PictureBox img = report.Items.Find("logo", true)[0] as PictureBox;
DataTable dt = dal.LeLogoEmpresa(Connection);
if (dt.Rows.Count > 0)
    foreach (DataRow dr in dt.Rows)
    {
        img.Value = dr["Logotipo"];
        img.MimeType = dr["ImgTip"].ToString();
        break;
}

How canI find the picturebox??

Thanks.

Stef
Telerik team
 answered on 10 May 2017
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?