C# 以C语言将SSRS报告呈现为横向格式PDF#

C# 以C语言将SSRS报告呈现为横向格式PDF#,c#,reporting-services,rendering,landscape,export-to-pdf,C#,Reporting Services,Rendering,Landscape,Export To Pdf,我正在用C#代码成功地将SSRS报告呈现为PDF格式。然而,我需要它的PDF格式是横向的,我一直无法得到工作 我已经尝试在DeviceInfo中相应地设置页面宽度和页面高度,但这似乎没有什么区别。我也弄乱了页面设置,但没有用 Uri oUri = new Uri(GlobalClass.gReportServerURL); //Run report rpt.ServerReport.ReportPath = "/" + sReportName; rpt.Se

我正在用C#代码成功地将SSRS报告呈现为PDF格式。然而,我需要它的PDF格式是横向的,我一直无法得到工作

我已经尝试在DeviceInfo中相应地设置页面宽度和页面高度,但这似乎没有什么区别。我也弄乱了页面设置,但没有用


    Uri oUri = new Uri(GlobalClass.gReportServerURL);

    //Run report
    rpt.ServerReport.ReportPath = "/" + sReportName;

    rpt.ServerReport.ReportServerUrl = oUri;
    paramList.Add(new Microsoft.Reporting.WinForms.ReportParameter ("ClientID", sClientID));

    rpt.ServerReport.SetParameters(paramList);

    deviceInfo = $@"<DeviceInfo>
                                <OutputFormat>PDF</OutputFormat>
                                <PageWidth>11in</PageWidth>
                                <PageHeight>8.5in</PageHeight>
                                <MarginTop>.25in</MarginTop>
                                <MarginLeft>.25in</MarginLeft>
                                <MarginRight>.25in</MarginRight>
                                <MarginBottom>.25in</MarginBottom>
                            </DeviceInfo>";

    ms = (MemoryStream)rpt.ServerReport.Render("PDF", deviceInfo, null, out  mimeType, out fileNameExtension);

    //Write it to disk
    bytes = ms.ToArray();
    fs = new System.IO.FileStream(sFile, System.IO.FileMode.Create);
    fs.Write(bytes, 0, bytes.Length);
    fs.Close();
    addPDFToList(sFile);
    lstKillFiles.Add(sFile);
    return sFile;

Uri oUri=新Uri(GlobalClass.gReportServerURL);
//运行报告
rpt.ServerReport.ReportPath=“/”+sReportName;
rpt.ServerReport.ReportServerUrl=oUri;
添加(新的Microsoft.Reporting.WinForms.ReportParameter(“ClientID”,sClientID));
rpt.ServerReport.SetParameters(paramList);
deviceInfo=$@”
PDF
11英寸
8.5英寸
.25英寸
.25英寸
.25英寸
.25英寸
";
ms=(MemoryStream)rpt.ServerReport.Render(“PDF”,deviceInfo,null,out mimeType,out fileNameExtension);
//将其写入磁盘
字节=ms.ToArray();
fs=newsystem.IO.FileStream(sFile,System.IO.FileMode.Create);
fs.Write(字节,0,字节.长度);
fs.Close();
addPDFToList(sFile);
lstKillFiles.Add(sFile);
返回sFile;

我希望PDF文件是横向的,但事实并非如此。

能否尝试在visual studio中对报表进行设置更改(我的意思是直接对报表进行设置,而不是通过c#进行设置)。尝试将报告以PDF格式导出到SSRS上,并使用C#。如果这样做有效,那么您可以在c#code.Ok中复制这些属性。愚蠢的提问时间。。。SSRS报表本身是否将页面设置为横向?能否尝试在visual studio中对报表进行设置更改(我的意思是直接对报表进行设置,而不是通过c#进行设置)。尝试将报告以PDF格式导出到SSRS上,并使用C#。如果这样做有效,那么您可以在c#code.Ok中复制这些属性。愚蠢的提问时间。。。SSRS报告本身是否将页面设置为横向?