【问题标题】:DevExpress XtraReport GDI+ Generic ErrorDevExpress XtraReport GDI+ 一般错误
【发布时间】:2015-08-12 21:29:05
【问题描述】:

我从报告中导出 excel 文件时收到此错误,从报告的预览中触发此操作。

xrptDoc.ExportToXlsX("D:\\ExportedFile.xlsx");

这是以下堆栈跟踪:

in DevExpress.XtraPrinting.Native.PSMessageBoxBase.ShowException(String text, String caption, IServiceProvider servProvider, Exception initialException)
in DevExpress.XtraPrinting.Native.PSMessageBoxBase.ShowException(Exception initialException, IServiceProvider servProvider)
in DevExpress.XtraPrinting.Native.FileExportHelper.ShowException(Exception e)
in DevExpress.XtraPrinting.Native.FileExportHelper.Execute(String path, Action1`1 callback)
in DevExpress.XtraPrinting.PrintingSystemBase.ExportXlsPage(String filePath, Action1`1 callback)
in DevExpress.XtraPrinting.PrintingSystemBase.ExportToXlsxInternal(String filePath, XlsxExportOptions options)
in DevExpress.XtraPrinting.PrintingSystemBase.ExportToXlsx(String filePath, XlsxExportOptions options)
in DevExpress.XtraReports.UI.XtraReport.ExportToXlsx(String path, XlsxExportOptions options)
in DevExpress.XtraReports.UI.XtraReport.ExportToXlsx(String path)

异常有一个内部异常。这是相同的错误(通用 GDI+ 错误)但堆栈跟踪不同:

in System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
in System.Drawing.Image.Save(Stream stream, ImageFormat format)
in DevExpress.XtraExport.XlsxPackage.AddDrawings(ZipArchive archive)
in DevExpress.XtraExport.XlsxPackage.CreateXlsxFile()
in DevExpress.XtraExport.ExportXlsxProvider.DevExpress.XtraExport.IExportProvider.Commit()
in DevExpress.XtraPrinting.Export.XLS.XlsExportProviderBase.Commit()
in DevExpress.XtraPrinting.Export.XLS.XlsExportProviderBase.CreateDocument(LayoutControlCollection layoutControls, Boolean correctImportBrickBounds)
in DevExpress.XtraPrinting.Export.XLS.XlsExportProviderBase.CreateDocument(Document document)
in DevExpress.XtraPrinting.Export.XLS.XlsxExportProvider.CreateDocument(Document document)
in DevExpress.XtraPrinting.PrintingSystemBase.ExportToXlsCore(XlsExportProviderBase xlsExportProvider)
in DevExpress.XtraPrinting.PrintingSystemBase.ExportToXlsx(Stream stream, XlsxExportOptions options)
in DevExpress.XtraPrinting.PrintingSystemBase.<>c__DisplayClassf.<ExportToXlsxInternal>b__d(Stream stream)
in DevExpress.XtraPrinting.Native.FileExportHelper.Execute(String path, Action1`1 callback)

【问题讨论】:

  • 您是否从服务运行报告创建? (即与预览分离?)您是否在报告中包含任何图像?如果是这种情况,是否可以在整个报告创建过程中读取该图像?
  • @AlexMazzariol 不包括报告中的图像。只是一张桌子
  • 用户是否有D:盘的写权限?抱歉这个看似微不足道的问题,但可能有助于排除原因。
  • @AlexMazzariol 是的!我理解这个问题。别担心
  • @jcvegan,此信息不足以检测问题的原因。我可以建议您执行以下操作:1)按照本文中的说明调整VS:devexpress.com/Support/Center/Question/Details/K18549,重现问题并获得真正的调用堆栈; 2)复制并粘贴到这里。 3) 提供您正在使用的 XtraReports Suite 的确切版本。尝试使用最新的(如果你没有它,你可以随时测试试用版,可以从devexpress.com下载),看看问题是否可以重现。

标签: c# winforms devexpress xtrareport


【解决方案1】:

查看您的屏幕截图后,我可能会假设您正在使用线条(可能是 XRCrossBandLines 或/和 XRCrossBandBoxes)。如果这些行太长,Excel 将无法处理它们。例如,XRCrossBandLine 从 ReportHeader 到 ReportFooter。如果是真的,不要排这么长的队。使它们从 PageHeader 转到 PageFooter。在这种情况下,行会更短,Excel 将能够处理它们。

另一件事我注意到你的报告可能有过路砖。您应该在报表设计器中得到相应的消息。如果属实,我建议您避免交叉,因为这样的布局可能无法正确导出到 Excel。

如果它没有帮助,我建议你让 DevExpress 支持来看看这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多