- Dim psDownLoadFileName As String = strPrintID &
- My.Resources.FixedValue.UnderLine &
- strPrintName &
- My.Resources.FixedValue.UnderLine &
- Now.ToString(My.Resources.FixedValue.DateFormat_YMDHMSF) &
- My.Resources.FixedValue.ExcelExtenstion2007
- Dim excelSetting As New Export.Excel.Page.ExcelRenderingExtensionSettings()
- excelSetting.FileFormat = Export.Excel.Page.FileFormat.Xlsx
- excelSetting.Pagination = False
- Dim setting As Extensibility.Rendering.ISettings = excelSetting
- Dim excelRenderingExtension As New Export.Excel.Page.ExcelRenderingExtension()
- Dim memoryProvider As New Rendering.IO.MemoryStreamProvider()
- rpt.Document.Render(excelRenderingExtension, memoryProvider, setting.GetSettings())
- Response.ContentType = My.Resources.FixedValue.Application_Excel
- Response.AddHeader(My.Resources.FixedValue.ResponseHeader_Key_Disposition,
- My.Resources.FixedValue.ResponseHeader_Key_Attach &
- My.Resources.FixedValue.Semicolon &
- My.Resources.FixedValue.ResponseHeader_Key_FileName &
- My.Resources.FixedValue.Equal &
- UrlEncode(psDownLoadFileName, System.Text.Encoding.UTF8))
- Dim secondaryStream As MemoryStream = DirectCast(memoryProvider.GetPrimaryStream().OpenStream(), MemoryStream)
- Response.BinaryWrite(secondaryStream.ToArray())
- Response.Flush()
- Response.End()
复制代码 代码和生成的Excel截图上传了。
文件问题点:
1,打开文件报错,怀疑和合并单元格有关。
2,文件第一行行高自动缩小了。
3,跨单元格显示的项目自动合并单元格了。(第一列和最后一列)。
4,中间个别项目列宽缩小到最小并且合并单元格了。
|