【发布时间】:2015-10-04 05:46:19
【问题描述】:
我正在为我的一份报告使用水晶报告。我需要为报告动态设置边距。边距由用户设置,因此我需要以编程方式应用边距。
我正在使用下面的代码以编程方式设置边距。
ReportDocument rd = new ReportDocument();
PageMargins pageMargins = new PageMargins();
pageMargins.leftMargin = 25;
pageMargins.topMargin = 100;
pageMargins.rightMargin = 25;
pageMargins.bottomMargin = 50;
rd.PrintOptions.ApplyPageMargins(pageMargins);
然后向用户显示打印预览,然后用户可以打印。我正在使用下面的代码来显示预览。
Response.Buffer = false;
Response.ClearHeaders();
Response.ClearContent();
rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "Print");
以上对我不起作用。它不应用边距(当我从 Design -> Page Setup 静态设置边距时也是如此)。它显示的内容好像在动态使用时没有应用边距。我已附上图片以了解它是如何显示为预览的。
谁能帮我解决可能是什么问题?为什么没有应用边距?
【问题讨论】:
标签: c# crystal-reports margin