【发布时间】:2015-08-01 23:34:12
【问题描述】:
我遇到了一个问题,我的水晶报表正在为每条记录创建 pdf 页面,尽管数据表被解析为仅包含一行的 pdf 生成。
我有一个查询,它根据 Id 选择单行,然后将其放入数据集数据表中并解析为水晶报表生成。
通过我可以确认数据表只包含一行,但输出的是pdf的多页,每页显示不同的行。
以前有没有人遇到过这种情况,如果有,是什么导致我的数据表被写入?
背后的代码:
public string CreateMaster(int Id)
{
DataTable dt = DataGrabber(Id);// returns a dataset
ExportOptions expo = new ExportOptions();
PdfRtfWordFormatOptions form = new PdfRtfWordFormatOptions();
string op = "";
string smp = DateTime.Now.ToString("yyyyMMddHHmm");
DiskFileDestinationOptions dfd = new DiskFileDestinationOptions();
op = @"E:\SomeFolder\Client_ID" + Id + "_TS"+ smp + ".pdf";
using (ClientDdPdf pdf = new ClientDdPdf())
{
pdf.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
pdf.PrintOptions.PaperSize = PaperSize.PaperA4;
pdf.SetDatabaseLogon(DbUser,DbPass,DbServer,DbDb);
pdf.SetDataSource(dt); // confirmed that the single datatable from dataset is parsed
dfd.DiskFileName = op;
expo = pdf.ExportOptions;
expo.ExportDestinationType = ExportDestinationType.DiskFile;
expo.ExportFormatType = ExportFormatType.PortableDocFormat;
expo.DestinationOptions = dfd;
expo.ExportFormatOptions = form;
pdf.Export(expo);
}
ReadPdfFile(op);
return op;
}
【问题讨论】:
标签: c# pdf datatable crystal-reports