asp.net C#Crystal Report导出到PDF内存已满 [英] asp.net c# crystal report export to PDF memory full

查看:104
本文介绍了asp.net C#Crystal Report导出到PDF内存已满的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Crystal Reports和VS2010构建报告:ASP.NET/C#相当大(使用OLE对象的页面为6页),所以我不确定这是否是此问题的原因或解决方案,但是我需要知道如何解决此问题或替代方法.我以相同方式使用OLE对象构建的所有其他报告仍然可以正常导出.

I am building a report using Crystal Reports and VS2010: ASP.NET/C# which is fairly big (6 pages using OLE Objects), so I am not sure if that would be the cause or solution to this problem, but I need to know either how to fix this or an alternative. All other reports that I built using OLE Objects in the same manner still export just fine.

我正在使用的代码是:

protected void exportPDF_btn_Click(object sender, EventArgs e)
{
    ReportDocument repDoc = getReportDocument(); //regathers the report

    Response.Buffer = false;

    Response.ClearContent();
    Response.ClearHeaders();

    try
    {
        repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "filename");
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        ex = null;
    }
    finally
    {
        Response.End();
    }
}

问题是我不断收到错误消息:

The problem is that I keep getting an error that says:

内存已满,无法导出报告,没有足够的内存用于 操作

Memory Full, Failed to export the report, Not enough memory for operation

我尝试过的其他解决方案:

Other solutions I have tried:

  • Resetting IIS
  • Restarting Server
  • Installing CutePDF as suggested: Crystal Report 2008 - Memory Full
  • Changing 3rd param from true to false resulting in this line of code:

repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,false,文件名");

repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "filename");

使用ExportToDisk而不是ExportToHttpResponse,导致 这段代码:

Using ExportToDisk as opposed to ExportToHttpResponse, resulting in this code:

repDoc.ExportToDisk(ExportFormatType.PortableDocFormat,@"Z:\ KFauver \ test \ file.pdf");

repDoc.ExportToDisk(ExportFormatType.PortableDocFormat, @"Z:\KFauver\test\file.pdf");

此报告是我最后要完成才能进行Beta测试的最后一项.但是,我现在对如何将其导出为PDF(或与此相关的任何内容)完全迷失了.任何帮助表示赞赏!无论是修复还是替代,都请尝试一下.预先感谢.

This report is one of the last items that I need to complete to finally be able to push to beta test. However, I am now officially lost as to how to export this to PDF (or anything for that matter). Any help is appreciated! Whether it be a fix or an alternative, ill try it. Thanks in advance.

推荐答案

显然,在报表上具有Word Doc OLE对象的6个实例将导致它需要太多内存.我没有意识到这一点.我的解决方法是拍摄每个页面的屏幕截图,然后将图像粘贴到报告中.似乎可以正常工作.

Apparently, having 6 instances of a word doc OLE object on a report will cause it to need too much memory. I did not realize this. My fix was to take screenshots of every page and paste the images into the report. Seems to work just fine that way.

这篇关于asp.net C#Crystal Report导出到PDF内存已满的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆