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
August 30th, 2005 4:41pm

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?
Free Windows Admin Tool Kit Click here and download it now
October 7th, 2005 5:24am

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
October 7th, 2005 7:07pm

Can you set the datasource of a report programmatically or must it be done at design time?
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2005 1:14pm

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()); } } }
November 11th, 2005 10:36am

at first u should create a table adaptor in ur dataset with the fileds u need, then add a dataset in ur report (.rdlc file) , and then use the code below in the form that u wanna show the report ( the form that have a report viewer): // I copied the code from one of my projects namespace MobShopAccounting { public partial class frmReportPrint : Form { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DBConnect db = new DBConnect(); public frmReportPrint() { InitializeComponent(); } private void GozareshKolChap_Load(object sender, EventArgs e) { DataTable dt= db.GetInfos();// through this line u should get ur informations from database with same columns as the tableadaptor u had created in dataset. reportDataSource1.Name = "DataSetName";// it should be same with the dataset u created in .rdlc file reportDataSource1.Value = dt; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MobShopAccounting.MyReport.rdlc"; this.reportViewer1.RefreshReport(); } } }
Free Windows Admin Tool Kit Click here and download it now
September 5th, 2012 4:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics