Telerik Forums
Reporting Forum
1 answer
134 views
Hi,

My application writes out to a basic CSV flat file, which I then want to report on.

I am had a look in the report designer but can not figure out how to use the flat file as the source of my report so that I can design the report.

I would also then need to be able to change the location of where the source csv flat file is at run time.

Is this possible ?

Thanks
Steve
Telerik team
 answered on 23 Feb 2009
1 answer
235 views
Hi,,,
 Tia is suriya.
I need a detailed explanation about the subreport programatically, i need an example report...

how the subreport is create  & passing parameter by coding.... please reply as soon as possible..,.

     By
Suriya
Steve
Telerik team
 answered on 23 Feb 2009
9 answers
825 views
Dear,

We are currently generating invoices using MS Word and filling in fields.We would like to move to a cleaner way of generating invoices using reports.

Let's say we have the following class (not our actual class, just quick example):

class Invoice
{
        int InvoiceID { get; set; }
        string ClientName { get; set; }
        string InvoiceReference { get; set; }
        DateTime InvoiceDate { get; set; }
        List<Task> InvoicedTasks { get; set; }
}

Is it possible to generate a report, based on this class (the header would show the ID, ClientName, InvoiceReference, InvoiceDate)? In detail we would get a list of tasks. And give as parameter something like the InvoiceID?

We don't want to use a database as source, because our class includes alot business logic.

Regards
Andy
Top achievements
Rank 1
 answered on 21 Feb 2009
3 answers
251 views
Hi I have a report that attaches to a business object data source and renders one object per page in the detail section.  There is a static page header and page footer.  In design time I design against a single business object.  At run time I bind to a list of these objects.  Everything works fine and looks good in th report viewer until I try and export to PDF.  If I run the report against a single object the export to PDF works fine.  If I bind to a list the detail section appears progressively lower and lower o the page as one progresses through the pages, however the header and footer appear where expected.  I thought it might have been one of the fields that has a cangrow attribute set to true, but that did not seem to be the problem.  I can send a copy of the exported PDF for you to get an accurate picture.
Steve
Telerik team
 answered on 20 Feb 2009
4 answers
144 views
Hi
I just made a small code pice to put in a row in a report. Just put the code in your report file and call it from your construter.

Sample 1: eks. "addEndRow("Hallo");
 /// <summary> 
        /// Tilføjer den sidste række data til denne siden  
        /// </summary> 
        /// <param name="tekst">Den tekst der skal stå i rækken</param> 
        public void addEndRow(string tekst)  
        {  
            if (tekst == null)    // Undersøger om tekst er null hvis dette sættes tekst til en tom string  
            {  
                tekst = "";     // Sætter tekst til en tom string  
            }  
 
            // Oprettelse af panel til indhold af tekstboks             
            var panel_1 = new Panel  
            {  
                Size =  
                    new SizeU(  
                    new Unit(10.45,  
                             ((UnitType.Cm))),  
                    new Unit(1,  
                             ((UnitType.Cm)))),  
                Dock = DockStyle.Left,  
                Style = { BorderStyle = { Default = BorderType.Solid } }  
            };  
 
            // Oprettelse af tekstboks til indhold af tekst  
            var textBox_1 = new TextBox  
            {  
                Value = tekst,  
                Dock = DockStyle.Top,  
                Style =  
                {  
                    TextAlign = HorizontalAlign.Left,  
                    VerticalAlignVerticalAlign = VerticalAlign.Top  
                },  
                Height = new Unit(1.5, UnitType.Cm),  
                Width = new Unit(1, UnitType.Cm),  
            };  
 
            panel_1.Items.AddRange(new ReportItemBase[] { textBox_1 });  
            panel_1.Dock = DockStyle.Top;  
 
            //Tilføjer panel til detail delen i rapporten  
            detail.Items.Add(panel_1);  
        } 

Sample 2. data is a array of string with lengh 6. addDataRow("1", "tekst_1", "tekst_2", new string[] { "x", "-", "-", "-", "-", "-" });
  /// <summary> 
        /// Opretter en række til at indsætte data i  
        /// </summary> 
        /// <param name="nr">det nummer der skal stå i det første felt</param> 
        /// <param name="tekst_1">Den tekst der skal stå i den første række</param> 
        /// <param name="tekst_2">Den tekst der skal stå i den anden række</param> 
        /// <param name="data">Dette er et array med "X" eller " ". De tjekmark som skal anvendes</param> 
        public void addDataRow(string nr, string tekst_1, string tekst_2, string[] data)  
        {  
            // Undersøger paremere for null  
            if (nr == null)  
            {  
                nr = "<n/a>";  
            }  
 
            if (tekst_1 == null)  
            {  
                tekst_1 = "<n/a>";  
            }  
 
            if (tekst_2 == null)  
            {  
                tekst_2 = "<n/a>";  
            }  
 
            if (data != null)  
            {  
                if (data.Length != 6)  
                    throw new Exception("Data længde på rapport forkert. Længde = " + data.Length +  
                                        ", men skulle være 6. ");  
            }  
            else  
            {  
                throw new Exception("data = null: fejl");  
            }  
 
            // Oprettelse af paneler  
            var panel_1 = new Panel  
                              {  
                                  Size =  
                                      new SizeU(  
                                      new Unit(10.45,  
                                               ((UnitType.Cm))),  
                                      new Unit(1,  
                                               ((UnitType.Cm)))),  
                                  Dock = DockStyle.Left,  
                                  Style = { BorderStyle = { Default = BorderType.Solid } }  
                              };  
            var panel_2 = new Panel  
                              {  
                                  Dock = DockStyle.Left,  
                                  Style = { BorderStyle = { Left = BorderType.Solid } },  
                                  Size =  
                                      new SizeU(  
                                      new Unit(10.446890830993652,  
                                               ((UnitType.Cm))),  
                                      new Unit(1.5,  
                                               ((UnitType.Cm))))  
                              };  
            var panel_3 = new Panel  
                              {  
                                  Width = new Unit(3.5, UnitType.Cm),  
                                  Height = new Unit(1.5, UnitType.Cm),  
                                  Style = { BorderStyle = { Left = BorderType.Solid } },  
                                  Dock = DockStyle.Right  
                              };  
            var panel_4 = new Panel { Dock = DockStyle.Right };  
 
            // Oprettelse af tekstbokse  
            var textBox_1 = new TextBox  
                                {  
                                    Value = nr,  
                                    Dock = DockStyle.Left,  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                        },  
                                    Height = new Unit(1.5, UnitType.Cm),  
                                    Width = new Unit(1, UnitType.Cm)  
                                };  
            var textBox_2 = new TextBox  
                                {  
                                    Value = tekst_1,  
                                    Height = new Unit(0.5, UnitType.Cm),  
                                    Dock = DockStyle.Top,  
                                    Style = { BorderStyle = { Bottom = BorderType.Solid } }  
 
                                };  
            var textBox_3 = new TextBox  
                                {  
                                    Dock = DockStyle.Top,  
                                    Value = tekst_2,  
                                    Height = new Unit(0.5, UnitType.Cm)  
                                };  
            var textBox_4 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                            BorderStyle =  
                                                {  
                                                    Left = BorderType.Solid,  
                                                    Right = BorderType.Solid  
                                                }  
                                        },  
                                    Value = data[2],  
                                    Dock = DockStyle.Right  
                                };  
            var textBox_5 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                            BorderStyle = { Left = BorderType.Solid }  
                                        },  
                                    Value = data[1],  
                                    Dock = DockStyle.Right  
                                };  
            var textBox_6 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle  
                                        },  
                                    Value = data[0],  
                                    Dock = DockStyle.Right  
                                };  
            var textBox_7 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                            BorderStyle = { Left = BorderType.Solid }  
                                        },  
                                    Value = data[5],  
                                    Dock = DockStyle.Right  
                                };  
            var textBox_8 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                            BorderStyle = { Left = BorderType.Solid }  
                                        },  
                                    Value = data[4],  
                                    Dock = DockStyle.Right  
                                };  
            var textBox_9 = new TextBox  
                                {  
                                    Size =  
                                        new SizeU(  
                                        new Unit(0.5,  
                                                 ((UnitType.Cm))),  
                                        new Unit(1.5,  
                                                 ((UnitType.Cm)))),  
                                    Style =  
                                        {  
                                            TextAlign = HorizontalAlign.Center,  
                                            VerticalAlignVerticalAlign = VerticalAlign.Middle,  
                                            BorderStyle = { Left = BorderType.Solid }  
                                        },  
                                    Value = data[3],  
                                    Dock = DockStyle.Right  
                                };  
 
            panel_2.Items.AddRange(new ReportItemBase[] { textBox_2, textBox_3 });  // Indsætter tekstboks 1 og 2 i panel 2  
            panel_4.Width = new Unit(0.5, UnitType.Cm);                             // Sætter bredden på panel 4 til 0.5 cm  
            panel_4.Height = new Unit(1, UnitType.Cm);                              // Sætter højden på panel 4 til 1 cm  
 
            panel_3.Items.AddRange(new ReportItemBase[] { textBox_7, textBox_8, textBox_9, panel_4, textBox_4, textBox_5, textBox_6 });     // Indsætter tekstbokse og panler i panel 3  
            panel_1.Items.AddRange(new ReportItemBase[] { textBox_1, panel_2, panel_3 });   // Indsætter tekstbokse og paneler i panel1  
            panel_1.Dock = DockStyle.Top;                                           // Dockter panel 1 til top  
 
            if (detail != null)                                                     // Underøsger om detail sektionens objekt er null  
            {  
                detail.Items.Add(panel_1);                                          // Indsætter panel 1 i detail sektoinen som er det område som indeholder hoved- data i rapporten  
            }  
        } 

Sample 3: setData(@"c:\pic1.jpg", "This is fine"); // Put in a path for a foto.
        /// <summary>  
        /// Sætter billed ind på siden  
        /// </summary>  
        /// <param name="filename">Sti til der hvor der ligger en billed fil</param>  
        /// <param name="text">Den firgur tekst der står under billedet</param>  
        /// <param name="s">Størrelse på billed</param>  
        public void setData(string filename, string text, params SizeU[] s)  
        {  
            try 
            {  
                if (!File.Exists(filename))  
                {  
                    text += Environment.NewLine + "Filen blev ikke fundet (" + filename + ")";  
                }  
 
                //Opretter tekstboks til at indeholde tekst der skal stå under hver billed  
                using (var textBox_1 = new TextBox  
                                           {  
                                               Size = new SizeU(new Unit(2, UnitType.Cm),  
                                                                new Unit(0.6, UnitType.Cm)),  
                                               Value = ("Figur " + figur_nr + ": " + text),  
                                               Dock = DockStyle.Top,  
                                               Multiline = true,  
                                               Style = {TextAlign = HorizontalAlign.Center}  
                                           })  
                {  
                    using (var pictureBox_1 = new PictureBox  
                                                  {  
                                                      Dock = DockStyle.Top,  
                                                      Value = new Bitmap(filename),  
                                                      Sizing = ImageSizeMode.ScaleProportional,  
                                                      Size = new SizeU(Unit.Cm(10), Unit.Cm(10))  
                                                  })  
                    {  
                        detail.Items.Add(pictureBox_1); // Indsætter billed objekt  
                    }  
                    detail.Items.Add(textBox_1); // Indsætter tekst der står under billedet  
                }  
 
                figur_nr++; // Forøger figur_nr med en   
            }  
 
            catch (Exception ex)  
            {  
                //Opretter tekstboks med fejlbesked i  
                var textBox_1 = new TextBox  
                                    {  
                                        Size =  
                                            new SizeU(  
                                            new Unit(2.0000002384185791, UnitType.Cm),  
                                            new Unit(0.60000020265579224, UnitType.Cm)),  
                                        Value =  
                                            ("Der opstod en fejl i indsættelse af billeder i PDF. Fejl:" + ex.Message),  
                                        Dock = DockStyle.Top,  
                                        Multiline = true,  
                                        Style = {TextAlign = HorizontalAlign.Center}  
                                    };  
 
                detail.Items.Add(textBox_1); // Indsætter tekst fejlbeskrivelse  
            }  
        } 

Sample 4: 

AddRow(

"Type", "Name", "Adress", "Phone number.:"); // Put in a Row. Call this metode to build op a page of rows with stuff 

        /// <summary>  
        /// Opretter en række med de personer som har medvirket til dette eftersyn  
        /// </summary>  
        /// <param name="str1">Faggruppebeskrivelse (type)</param>  
        /// <param name="str2">JuridiskNavn (navn mm.)</param>  
        /// <param name="str3">Adresse (Består af adr1 og adr2)</param>  
        /// <param name="str4">Telefonnummer. Det telefon nummer som anvendes til at kontakte denne person</param>  
        public void AddRow(string str1, string str2, string str3, string str4)  
        {  
            if (str1 == null)  
            {  
                str1 = "";  
            }  
 
            if (str2 == null)  
            {  
                str2 = "";  
            }  
            if (str3 == null)  
            {  
                str3 = "";  
            }  
            if (str4 == null)  
            {  
                str4 = "";  
            }  
 
            // Oprettelse af paneler  
            var panel_1 = new Panel  
            {  
                Size =  
                    new SizeU(  
                    new Unit(15,  
                             ((UnitType.Cm))),  
                    new Unit(0.5,  
                             ((UnitType.Cm)))),  
                Dock = DockStyle.Right,  
                Style = { BorderStyle = { Default = BorderType.Solid } }  
            };  
            var panel_3 = new Panel  
            {  
                Width = new Unit(15, UnitType.Cm),  
                Height = new Unit(0.5, UnitType.Cm),  
                Style = { BorderStyle = { Left = BorderType.None } },  
                Dock = DockStyle.Left  
            };  
            var panel_4 = new Panel { Dock = DockStyle.Right };  
 
            // Oprettelse af tekstbokse  
            var textBox_7 = new TextBox  
            {  
                Size =  
                    new SizeU(  
                    new Unit(3.5,  
                             ((UnitType.Cm))),  
                    new Unit(0.5,  
                             ((UnitType.Cm)))),  
                Style =  
                {  
                    TextAlign = HorizontalAlign.Left,  
                    VerticalAlign = VerticalAlign.Middle,  
                    BorderStyle = { Left = BorderType.Solid }  
                },  
                Value = str1,  
                Dock = DockStyle.Left  
            };  
 
            var textBox_8 = new TextBox  
            {  
                Size =  
                    new SizeU(  
                    new Unit(3.5,  
                             ((UnitType.Cm))),  
                    new Unit(0.5,  
                             ((UnitType.Cm)))),  
                Style =  
                {  
                    TextAlign = HorizontalAlign.Left,  
                    VerticalAlign = VerticalAlign.Middle,  
                    BorderStyle = { Left = BorderType.Solid }  
                },  
                Value = str2,  
                Dock = DockStyle.Left  
            };  
 
            var textBox_9 = new TextBox  
            {  
                Size =  
                    new SizeU(  
                    new Unit(3.5,  
                             ((UnitType.Cm))),  
                    new Unit(0.5,  
                             ((UnitType.Cm)))),  
                Style =  
                {  
                    TextAlign = HorizontalAlign.Left,  
                    VerticalAlign = VerticalAlign.Middle,  
                    BorderStyle = { Left = BorderType.Solid }  
                },  
                Value = str3,  
                Dock = DockStyle.Left  
            };  
 
            var textBox_10 = new TextBox  
            {  
                Size =  
                    new SizeU(  
                    new Unit(3.5,  
                             ((UnitType.Cm))),  
                    new Unit(0.5,  
                             ((UnitType.Cm)))),  
                Style =  
                {  
                    TextAlign = HorizontalAlign.Left,  
                    VerticalAlign = VerticalAlign.Middle,  
                    BorderStyle = { Left = BorderType.Solid }  
                },  
                Value = str4,  
                Dock = DockStyle.Right  
            };  
 
            panel_3.Items.AddRange(new ReportItemBase[] { textBox_7, textBox_9, textBox_8, textBox_10 });  
 
            panel_1.Items.AddRange(new ReportItemBase[] { panel_3 });  
            panel_1.Dock = DockStyle.Top;  
 
            if (str2.Length < 2 && str3.Length < 2 && str4.Length < 2)  
            {  
                panel_1.Style.BorderStyle.Default = BorderType.None;  
                panel_3.Style.BorderStyle.Left = BorderType.None;  
                textBox_9.Style.BorderStyle.Left = BorderType.None;  
                textBox_8.Style.BorderStyle.Left = BorderType.None;  
                // textBox_7.Style.BorderStyle.Left = BorderType.None;  
                textBox_10.Style.BorderStyle.Left = BorderType.None;  
                //textBox_10.Style.BorderStyle.Right = BorderType.Solid;  
                panel_1.Style.BorderStyle.Right = BorderType.Solid;  
                textBox_7.Style.Font.Bold = true;  
            }  
 
            if (detail != null)  
                detail.Items.Add(panel_1);  
        }  
 

Sincerely,
Janus S. Andersen
Janus Pedersen
Top achievements
Rank 2
 answered on 19 Feb 2009
7 answers
242 views
Hi

Reporting's TextBox.WordWrap does not appear to function.

With WordWrap set to false, I still get wrapping instead of truncating.

Designer view

HTML report view

version is beta 2.
Mike
Top achievements
Rank 1
 answered on 18 Feb 2009
1 answer
277 views
Hello,

I load the data for several of my reports through a web services layer, which can sometimes be a tad slow (as you might expect). I display a Windows Form dialog that has a report viewer embedded in it, and the dialog then requests the report data asynchronously.

What I would like to do is force the report viewer to show the "progress" animation while I'm out fetching data through the web service. But there doesn't seem to be a method within the viewer class that would support such.

Is there a way to do this? If so, how?
Steve
Telerik team
 answered on 18 Feb 2009
1 answer
106 views
Hi,

Can I put a RadGrid Control inside Report control? it'll be a great help in reporting issues.

Thanks
Steve
Telerik team
 answered on 18 Feb 2009
1 answer
204 views
HI,

    I just like to know if it's possible to create the index in the Telerik Reporting?  that means, i have a report that shows the page number with some content, and i will have another page just display certain keywords with the page number after it?

Thanks.
Steve
Telerik team
 answered on 18 Feb 2009
1 answer
110 views
Hello! I'm just getting used to the report designer, so these could totally be my ignorance - if there's a good way to do what i'm asking, please enlighten me!

Here are two things I'm missing from the designer (that are -gasp- included in competitive products):
1) Since my datasources aren't accessible at design time, I would LOVE to be able to specify a DataSourceSchema at design time and point it at an .xsd file, for instance (which I could easily make from my data objects by doing a WriteXmlSchema,say), so that the designer could still give me a list of fields and such.

2) The designer snap-to-grid is a bit odd.  If I set my snap to grid size at .05 inches, and start dragging a text box, I get snap sizes that are just a bit shy of the grid - for example, it will snap to .89in by .34 in, rather than .9 by .35.  Perhaps this is done to prevent text boxes from overlapping, however I WANT them to overlap - I have a very boxy form to reproduce and having to adjust them all manually is a bummer.  My output format is PDF and can handle the overlap.  Can we get an option (or is there one) to actually snap everything to the grid?

Thanks,
Scott
Steve
Telerik team
 answered on 17 Feb 2009
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?