We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing the report content before the report is loaded on runtime

Thread ID:





112497 Sep 25,2013 05:12 PM UTC Oct 1,2013 11:11 AM UTC WPF 3
Tags: ReportViewer
Asked On September 25, 2013 05:12 PM UTC

I am currently looking at Syncfusion Reports. I found out that you are using *.rdlc files to generate the report. Do you have samples that changes the content of a report before the rdlc is loaded on runtime?

For e.g. I have a Title label which I would like to change its location, width, height, font face before I load the report.

Thank you.

Anandakumar S [Syncfusion]
Replied On September 26, 2013 12:23 PM UTC

Hi Ronnie,


Thanks for using Syncfusion Products.


You can modify the rdlc report contents using Syncfusion ReportDesigner. Please find attached sample for your reference.


RDLC sample:



Customization samples:

http://www.syncfusion.com/uploads/user/directTrac/111476/Report Designer-2127117473.zip


Please let us know if you have any questions.



Anandakumar S

Replied On September 28, 2013 02:53 PM UTC

Hello Anandakumar,

Thanks for your reply and examples. However I don't want the user be able to change the layout of the report themselves.

Let say I have an *.rdl file which has a Title and Description saved as centered. Then I have these certain users or clients of my application that when they load this rdl file, the Title and Description must be positioned Right Aligned. I would like to achieve this before loading the report and on runtime.

Anandakumar S [Syncfusion]
Replied On October 1, 2013 11:11 AM UTC

Hi Ronnie,


Thanks for your update.


You can change the report in code behind by modifying needed properties of report items in the ReportDefinition. Please find the sample code to modify ReportDefinition below.


Serializing Report and modifying the ReportDefinition.


FileInfo info = new FileInfo("../../Sales Report.rdl");

FileStream stream = new FileStream(info.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);

XElement rdl = XElement.Load(XmlReader.Create(stream));

string Namespace = (from attribute in rdl.Attributes() where attribute.Name.LocalName == 'xmlns' select attribute.Value).FirstOrDefault();

string Version = (Regex.IsMatch(Namespace, @'\d{4}') ? Regex.Match(Namespace, @'\d{4}').Value : string.Empty);

XmlSerializer xs = new XmlSerializer(typeof(Syncfusion.RDL.DOM.ReportDefinition), Namespace);

Syncfusion.RDL.DOM.ReportDefinition report;

using (StringReader reader = new StringReader(rdl.ToString()))


report = (Syncfusion.RDL.DOM.ReportDefinition)xs.Deserialize(reader);


//Similarly you can change the positions of Header,Footer items of the report from the collection report.Page.PageFooter.ReportItems and report.Page.PageHeader.ReportItems

foreach (var reportItem in report.Body.ReportItems)


reportItem.Height = new Syncfusion.RDL.DOM.Size(25);

reportItem.Width = new Syncfusion.RDL.DOM.Size(150);

//Position of the reportitem

reportItem.Left = new Syncfusion.RDL.DOM.Size(180);

reportItem.Top = new Syncfusion.RDL.DOM.Size(180);



Please let us know if you have any questions.



Anandakumar S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon