I have Created a report dynamically from c# and done it successfully, Now the problem is it is aligned in Right and i wish to bring it at the center. How to do that ?
My code is here :
private void ShowReport()
{
ReportDataSource rds = new ReportDataSource("MyData", m_dataSet.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.RefreshReport();
this.reportViewer1.LocalReport.LoadReportDefinition(m_rdl);
reportViewer1.LocalReport.GetDefaultPageSettings().Margins.Right = 125; //Has no effect
this.reportViewer1.RefreshReport();
}
I also tried :
public static Rdl.Report CreateReport(string groupBy)
{
Rdl.Report report = new Rdl.Report();
try
{
report.Items = new object[]
{
CreateDataSources(),
CreateHeader(groupBy),
CreateBody(groupBy),
CreateDataSets(),
"9.5in",
"1.5in",
};
report.ItemsElementName = new Rdl.ItemsChoiceType37[]
{
Rdl.ItemsChoiceType37.DataSources,
Rdl.ItemsChoiceType37.PageHeader,
Rdl.ItemsChoiceType37.Body,
Rdl.ItemsChoiceType37.DataSets,
Rdl.ItemsChoiceType37.Width,
Rdl.ItemsChoiceType37.LeftMargin,
};
}
catch (Exception ex) { }
return report;
}
please note that i do not have to set the alignment of reportviewer, I have to set the the alignment of report on reportviewer.