Я успешно отрисовываю отчет SSRS в PDF в своем коде C #.Однако мне нужно, чтобы PDF был в альбомном формате, и я не смог заставить его работать.
Я попытался соответственно настроить ширину страницы и PageHeight в 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;
Я ожидаю, что файл PDF будет в альбомной ориентации, но это не так.