RDLC报告不尊重我的页面高度选项

问题描述 投票:0回答:2

我正在将此DeviceInfo传递给报告:

<DeviceInfo>
  <OutputFormat>Word</OutputFormat>
  <PageWidth>11in</PageWidth>
  <PageHeight>8.5in</PageHeight>
  <MarginTop>1in</MarginTop>
  <MarginLeft>0.5in</MarginLeft>
  <MarginRight>0.5in</MarginRight>
  <MarginBottom>1in</MarginBottom>
</DeviceInfo>

但是,当报表呈现时(如Word或PDF),页面大小是11 x 11英寸,而不是11 x 8.5(横向)。为什么是这样?如何获得具有适当尺寸的报告?

这里是我呈现报告的位置:

byte[] bytes = Report.Render( // Report is an instance of the Microsoft.Reporting.WebForms.LocalReport class
    reportType,
    deviceInfo, // this contains the XML above
    out mimeType,
    out encoding,
    out fileNameExtension,
    out streams,
    out warnings);
reporting rdlc
2个回答
0
投票

[在报表生成器或Visual Studio中,您还必须将报表的布局设置为Landscape,这样它将知道如何渲染Landscape Property


0
投票

看来报告页面大小没有正确初始化,所以我这样做了:

var page = report.Page;

page.LeftMargin = LeftMargin;
page.RightMargin = RightMargin;

page.TopMargin = TopMargin;
page.BottomMargin = BottomMargin;

// I added these next two lines
page.PageWidth = PageWidth;
page.PageHeight = PageHeight;
© www.soinside.com 2019 - 2024. All rights reserved.