Data Formatting not retained when exporting to .xls
I'm using XtraReports, I'm having issues when exporting report to .xls
Some of my data needs formatting before being displayed to browser.
private void xrTableCell1_BeforePrint(object sender, PrintEventArgs e)
{
xrTableCell1.Text = "(" + xrTableCell1.Text + ")";
}
to format my data before printing, I use the code above. But when exporting data to .xls
, the appended "("
and ")"
are removed.
I happen to see that it is occuring when I'm using the following code:
xrTableCell1.DataBindings.Add("Text", DataSource, "ClassPropertyName");
But is not occurring when i simply use:
xrTableCell1.Text = "My Data";
The thing is, I cannot use .Text
for I'm binding 开发者_JAVA技巧multiple rows of data. Why is that happening? Is there a solution/alternative for this? Thanks a lot :D
Was able to fix this issue. Just after the CreateDocument()
method, add this line of code:
ReportViewer.Report.ExportOptions.Xls.TextExportMode = TextExportMode.Text;
精彩评论