水晶报表分页导出PDF时动态加载的图片、控件未更新
潇炜 2011-02-16 05:05:06 我用VS2005+水晶报表Web版做了一个每页显示一项详细植物信息、图片的报表。
例如:
Plant表中保存了 PlantName, LeafColor,PlantImageUrl三个字段。
在报表中使用子报表动态加载PlantImageUrl字段中记录的图片
然后根据LeafColor字段中保存的颜色数据(如"|#CCCCCC||#DDDDDD|"),经过字符串处理后,更改两个BoxObject的FillColor,来表示不同阶段的颜色。
在浏览器中直接浏览都显示正确,每次翻页,图片和BoxObject都会根据当前的植物改变颜色。
但是在导出PDF后出现问题:PlantName显示正确,但是动态修改的部分——图片、代表叶子颜色的BoxObject颜色始终没有跟着植物的变化而变化,都显示的是第一页的状态。
导出使用的代码:
CrystalDecisions.Shared.DiskFileDestinationOptions objFile = new DiskFileDestinationOptions();
objFile.DiskFileName = this.Server.MapPath(@"Export\SelectedPlantReport_" + DateTime.Now.Date.ToString("yyyy_MM_dd") + ".pdf");
sourceSelectedPlant.ReportDocument.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
sourceSelectedPlant.ReportDocument.ExportOptions.DestinationOptions = objFile;
sourceSelectedPlant.ReportDocument.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
sourceSelectedPlant.ReportDocument.Export();