我正在使用 SQL Server Reporting 服务生成报告并使用报告查看器控件显示它。 它在页面左侧显示报告。我希望它居中对齐。
我尝试了 Following things 但没有成功。
- 在
div
或table
中包装报表查看器控件并使其居中对齐。 - 报表查看器控件的缩放模式。
所以请给我一些使它居中对齐的解决方案。
最佳答案
像这样尝试:
<div align="center">
<rsweb:ReportViewer ID="ReportViewer1" runat="server" DocumentMapWidth="100%"
Font-Names="Verdana" Font-Size="8pt" PromptAreaCollapsed="True"
ShowToolBar="False" Width="1100px" Height="100%">
</rsweb:ReportViewer>
</div>
或使用 JQUERY:
$('#ReportViewer1_fixedTable tbody tr').attr("align", "center");
或服务器端:
ReportPageSettings rst = rptVwr.LocalReport.GetDefaultPageSettings();
if (rptVwr.ParentForm.Width > rst.PaperSize.Width)
{
int vPad = (rptVwr.ParentForm.Width - rst.PaperSize.Width) / 2;
rptVwr.Padding = new Padding(vPad, 1, vPad, 1);
}
[调整高度和宽度]
希望对您有所帮助。
关于c# - SQL Server报告对齐到网页中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15847704/