SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Setting values at runtime in a form report

Last post 04-16-2008 7:49 AM by Peter Forstmeier. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-10-2008 3:34 PM

    • RussGreen
    • Top 150 Contributor
    • Joined on 10-07-2006
    • Bristol (England)
    • Posts 15

    Setting values at runtime in a form report

    I've just looking at using SharpReport but I'm having trouble finding any samples.

     What I would like to do is have a form type report and at runtime set the values of some of the label on the form.  Is this possible or do I only have the option to use pull/push data models?

    What do you do when the data doesn't necessarily come from a database? 

     TIA

     Russ

    Filed under: ,
  • 02-11-2008 8:34 AM In reply to

    Re: Setting values at runtime in a form report

    Hi Russ,

    the samples are included in the SourceCode of SharpDevelop.

    You can get it here:

    http://wiki.sharpdevelop.net/AccessingTheRepository.ashx

    Ih the samples you will find reports that are doing exactly what you would like to do. Mainly have look to 'ContributorsList.srd' this report make havy use of filling fileds with Custom Code.

    Peter

     

  • 04-11-2008 4:51 PM In reply to

    Re: Setting values at runtime in a form report

    hi,

     

    This example is to add:

            ICSharpCode.Reports.Core.ReportModel rm = ICSharpCode.Reports.Core.ReportEngine.LoadReportModel("Report1.srd");
           

            ICSharpCode.Reports.Core.BaseTextItem item1 = new ICSharpCode.Reports.Core.BaseTextItem();
            item1.Text = "Nr of Contributor's:";
            item1.Location = new System.Drawing.Point(70, 10);
            item1.Size = new System.Drawing.Size(110, 20);
            item1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12);
            item1.ForeColor = System.Drawing.Color.Black;
            rm.ReportHeader.Items.Add(item1);

     

    And what about to edit one textitem at runtime that were made at design-time? 

  • 04-12-2008 11:14 AM In reply to

    Re: Setting values at runtime in a form report

    Hi superbeem,

    have a look to 'ContributorsList.cs' in method

    'private void PushPrinting (object sender,SectionRenderEventArgs e) ' 

        case GlobalEnums.ReportSection.ReportDetail:
         BaseRowItem ri = e.Section.Items[0] as BaseRowItem;
         if (ri != null) {

    !! Find the item
          BaseDataItem r = (BaseDataItem)ri.Items.Find("unbound1");
         if (r != null) {

    !!Set the value here
                 }
         }
         break;

    hope this was helpfull to you

    Peter

  • 04-14-2008 5:19 PM In reply to

    Re: Setting values at runtime in a form report

    Hi,

     To edit a textitem as to be like this:

     

    ICSharpCode.Reports.Core.ReportModel rm = ICSharpCode.Reports.Core.ReportEngine.LoadReportModel("Report1.srd");

    try{
         ICSharpCode.Reports.Core.BaseTextItem item1 =(ICSharpCode.Reports.Core.BaseTextItem)rm.ReportHeader.Items.Find("reportTextItem1");
         item1.Text = "Title edit";
         }catch { }

    Without the try block it trows exception if doesn't exist the item when finding it.

     

  • 04-16-2008 7:49 AM In reply to

    Re: Setting values at runtime in a form report

    Hi,

    I think this is the best way to debug an report.

    Peter

Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.