在将report导出至excel中时,数字类型总是以文本类型显示,即在单元格靠左。请问应该在导出的时候做哪些设置才可以避免这样啊?还是在报表样式上作调整?谢谢!
导出部分代码如下:
- ActiveReport rpt = new ActiveReport();
- try
- {
- rpt.Run(false);
- }
- catch (DataDynamics.ActiveReports.ReportException eRunReport)
- {
- // Failure running report, just report the error to the user:
- Response.Clear();
- Response.Write("<h1>Error running report:</h1>");
- Response.Write(eRunReport.ToString());
- return;
- }
- Response.ContentType = "application/vnd.ms-excel";
- Response.AddHeader("content-disposition", "inline; filename=MyXLS.xls");
- // Create the EXCEL export object
- XlsExport xls = new XlsExport();
- // Create a new memory stream that will hold the xls output
- System.IO.MemoryStream memStream = new System.IO.MemoryStream();
- // Export the report to EXCEL:
- xls.Export(rpt.Document, memStream);
- xls.UseCellMerging = true;
- // Write the EXCEL stream out
- Response.BinaryWrite(memStream.ToArray());
- // Send all buffered content to the client
- Response.End();
复制代码 |
|