Issue generating Report by code

Stimulsoft Reports.NET discussion
Post Reply
pommes
Posts: 4
Joined: Sun Jan 20, 2013 9:32 am

Issue generating Report by code

Post by pommes »

Hello,

I am creating a report by code, which works okay, but does not show a vertical line.
I can't figure out what I am doing wrong.
Text and horizontal line are shown. ( I also tried barcode which works well.)
The version I use is 2012.3.1500.0 (I know quite a bit outdated...)
I've minimized the code to this c# console application:

Code: Select all

  
        static void Main(string[] args)
        {
            try
            {
                StiReport rep = new StiReport();
                StiPage page = rep.Pages[0];

                StiText dataText = new StiText(new RectangleD(0, 0, 14, 14));
                dataText.Border.Side = StiBorderSides.None;
                dataText.Text = "ABC";
                dataText.Name = "DataText" ;
                page.Components.Add(dataText);


                Stimulsoft.Report.Components.StiHorizontalLinePrimitive hl = new StiHorizontalLinePrimitive();
                hl.Color = System.Drawing.Color.Red;
                hl.Left = 3;
                hl.Top = 4;
                hl.Height = 4;
                hl.Width = 5;
                hl.Size = 5;
                hl.Name = "Hor";
                hl.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
                page.Components.Add(hl);

                Stimulsoft.Report.Components.StiVerticalLinePrimitive vl = new StiVerticalLinePrimitive();
                vl.Color = System.Drawing.Color.Green;
                vl.Left = 2;
                vl.Top = 3;
                vl.Height = 5;
                vl.Width = 5;
                vl.Size = 5;
                vl.Name = "Vert";
                vl.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
                page.Components.Add(vl);


                StiOptions.Viewer.AllowUseDragDrop = false;
                rep.Show(true);

            }
            catch (Exception eX)
            {

                Console.WriteLine("Error: " + eX.Message);
            }
        }
Attachments
minimized_2.mrt
rep.SavePackedReport
(1.44 KiB) Downloaded 123 times
minimized_1.mrt
(985 Bytes) Downloaded 132 times
minimized.mrt
rep.SaveReportSourceCode
(7.51 KiB) Downloaded 135 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Issue generating Report by code

Post by Alex K. »

Hello,

The VerticalLinePrimitive should contain to points - Start and End:
Stimulsoft.Report.Components.StiStartPointPrimitive StartPointPrimitive1;
Stimulsoft.Report.Components.StiEndPointPrimitive EndPointPrimitive1;

The simple way - it creates report in the designer then open Code tab and uses the similar code in your project.

Thank you.
pommes
Posts: 4
Joined: Sun Jan 20, 2013 9:32 am

Re: Issue generating Report by code

Post by pommes »

Thanks a lot, worked !
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Issue generating Report by code

Post by Alex K. »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply