Programmatically Accessing Report Item Properties

Hello All,

                  I have been racking my brains trying to figure out how to access the properties of the Report Items in a given report. I would appreciate any help in this direction. The task I am faced with is to break up a given string i fetch from the database and and distribute it over 3 different textboxes in a report. For this, I was thinking of creating a custom assembly with a function which takes in the string and size (width and height) of a textbox, the font information (family, size etc) to determine what substring will fit into the given textbox.

I have a textbox name textbox12. I tried to set the value of it with the above function  but i am not able to pass any information abt the textbox to the method (i tried Me.Size.Width, ReportItems!textbox12.Size.Width and so on so forth) Please advise me as to how to go about accomplishing this task. Thanks



Answer this question

Programmatically Accessing Report Item Properties

  • Yaniv1

    Can you set the datasource of a report programmatically or must it be done at design time

  • GMatono

    Sorry, these properties are not exposed through the ReportObjectModel at this point.

    Though not trivial and not applicable for general scenarios, I could imagine an approach where you have a custom assembly that loads the report rdl file and determines the desired properties by reading the report definition properties for that report item.

    We are considering making the ReportObjectModel richer in future releases to provide report authors more access and control over reportitem properties at report processing/execution time. Suggestions of what particular properties you think are important and why they are so important, will help us assigning priorities accordingly.

    -- Robert

  • Nori_at_Japan

    Sure thing...

    [C#]

    using System; using System.Web.Services.Protocols; class Sample { public static void Main() { ReportingService rs = new ReportingService(); rs.Credentials = System.Net.CredentialCache.DefaultCredentials; DataSourceReference reference = new DataSourceReference(); reference.Reference = "/SampleReports/AdventureWorks"; DataSource[] dataSources = new DataSource[1]; DataSource ds = new DataSource(); ds.Item = (DataSourceDefinitionOrReference) reference; ds.Name = "AdventureWorks"; dataSources[0] = ds; try { rs.SetReportDataSources("/SampleReports/Product Catalog", dataSources); Console.WriteLine("New reference set for the report."); } catch (SoapException e) { Console.WriteLine(e.Detail.InnerXml.ToString()); } }
     

    }



  • jeanlucve

    Hi,

    I am trying to do the very same thing, but can't find the way in, have you had any luck with this problem

  • Programmatically Accessing Report Item Properties