on 01-07-2015 1:05 PM
Hi,
In our web application developed in Visual Studio 2012, when I try to export crystal reports, I am getting the following error:
Method not found: 'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'
It used to work fine in Visual Studio 2008, exporting to Pdf, Word & Excel.
It was also working fine exporting to Pdf & Word in the Visual Studio 2012 application using crystal reports 2008.
But it would not work for Excel.
So in an effort to get it working I installed Crystal Reports 2013 and downloaded the latest visual studio developer version (Support Pack 12) from this site:
(I've tried Support Pack 10 also).
My code is quiet straightforward, here is a shortened version of it:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
.
.
.
Report.Load(reportPath + reportName)
Report.FileName = reportPath + reportName
Report.Database.Tables(0).SetDataSource(dataTableName)
oStream = CType(Report.ExportToStream(ExportFormatType.PortableDocFormat), MemoryStream)
On the last line above, it throws the following error:
Method not found: 'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'
Any help on this issue would be appreciated.
Thanks,
John
Hi John
This is a known issue documented in this KBA:
2105311 - ExportToStream throws exception in SP 12 in Crystal Reports for Visual Studio
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Everyone,
As a quick resolution what we did in our recent programs we created a extension method for the ReportDocument object
so only you have to replace in your code
ReportDocument cr = new ReportDocument()
....
..
(MemoryStream)cr.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
can be converted in to
cr.ExportToMemoryStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
yes from vs 2008 onward you can start use the extension methods
a quick sample of extension code will look like
public static class Extensions
{
public static MemoryStream ExportToMemoryStream(this ReportDocument cr, ExportFormatType reportformat)
{
Stream tempStream = cr.ExportToStream(reportformat);
MemoryStream tempMemStream = new MemoryStream();
tempStream.CopyTo(tempMemStream);
tempStream.Close();
return tempMemStream;
}
}
" !!!!Hope this helps at least as a quick resolution for the issue and " hoping that future sap will not add a method like this to make another issue
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vimal,
I just got a chance to test your code there now.
Unfortunately, I still get the same error on the line where it tries to export the report to a Stream:
'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'
I'm using version 13.0.10.1385 of the developer dll's (Service Pack 12).
Are you using the same version?
I don't mind converting a Stream to MemoryStream if this is the workaround, but that isn't working either.
Any ideas?
Thanks,
John
I just got an update from R&D on the issue. It is not good news;
In a nutshell, export to memory stream was never supported. The Crystal Reports .NET API Guide states that the only return type is System.IO.Stream:
Unfortunately, this will not be "fixed" or updated as investigation showed that this would cause other issues.
- Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ludek,
We've been exporting crystal reports to a 'MemoryStream' for years in our web applications.
It worked in previous crystal report developer files (e.g. v12.0.2000.683, v10.5.0.1943).
Why would they take out something that worked in an older version?
Doesn't really make sense to be honest.
Is it best if I use v10.5.0.1943 of the CR dll's to continue to export reports to a memory stream?
Regards,
John
Hello John,
There had a long discussion regarding the same issue and we did not get any positive response from sap
We are still in hold of the upgrade of crystal report in production and cloud even in development pcs
For us it is very hard to recompile again old dlls to our clients as this will make somany issues
Dear Luke
, please ask the developers to revert the original code in next sp, many people are going to report the same issue as this was a complete convinent code we started early in. Net 1.1 and we never faced any issues related to that and suddenly!!!!
Regards
It is not possible to revert the code.
The modification that causes the issue, was done under the assumption that the API was used as described in the API Guide. E.g.; the modification does not affect System.IO.Stream as this was always supported. It affects unsupported Memory.Stream, which was never supported. Reverting the code base will cause issues that the modification was meant to address in the 1st place.
I feel your pain, but R&D has spent a significant amount of time investigating the issue and it is their assessment that more changes will destabilize the product at best and make it unusable at worst.
- Ludek
Ludek - I'm confused. Is this the same issue as the thread: http://scn.sap.com/thread/3632979 Because if so, the last comment you make is that the developer's know about the issue and that it will be fixed in the next release - SP 13:
--------------------------------------------------------------------------
Hi Deana, My initial tests with SP 12 I could get it to create the file but it was always either 0 size or un-readable by Adobe Reader. I pinged the developers last night and we believe we know why it's failing now... It was an older Adapt that was propagated into SP 11 - ADAPT01320923 - Unable to export file larger than 300mb Only happens when exporting to System.IO.MemoryStream It’s OK with System.IO.Stream So I'll get this into the SP 13 required fixes and We should be able to fix it. SP 13 is tentatively due out end of January, but that just an estimate at this time... Thanks again Don -----------------------------------------------------------------------
Please advise.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.