此代码用于在VB中工作,无法查明我在这里缺少什么。
System.IO.MemoryStream oStream = new System.IO.MemoryStream();
if (rptName == "rpt_BankFormatExCopy.rpt" | rptName == "GIS_reportExFormat.rpt" | rptName == "GPFDeductionRepExFormat.rpt")
oStream = rptObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord);
else
oStream = rptObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
答案 0 :(得分:0)
看起来rptObject
是Stream
在这种情况下,您可以只使用CopyTo
var oStream = new MemoryStream();
Stream stream = null;
if (rptName == "rpt_BankFormatExCopy.rpt" | rptName == "GIS_reportExFormat.rpt" | rptName == "GPFDeductionRepExFormat.rpt")
stream = rptObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord);
else
stream = rptObject.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
stream.CopyTo(oStream);