本文整理汇总了C#中LocalReport.GetDefaultPageSettings方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.GetDefaultPageSettings方法的具体用法?C# LocalReport.GetDefaultPageSettings怎么用?C# LocalReport.GetDefaultPageSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalReport
的用法示例。
在下文中一共展示了LocalReport.GetDefaultPageSettings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocalReportPrinter
public LocalReportPrinter(string reportFullPath, PaperSize paperSize = null)
{
_reportFullPath = Application.StartupPath + @"\" + reportFullPath;
_report = new LocalReport { ReportPath = _reportFullPath };
_paperSize = paperSize ?? _report.GetDefaultPageSettings().PaperSize;
_streams = new List<Stream>();
}
示例2: executeReport_click
protected void executeReport_click(object sender, EventArgs e)
{
if (reportSelector.SelectedIndex == 9)
executeReportInAppDomain_click(sender, e);
else
{
LocalReport rpt = new LocalReport();
rpt.EnableExternalImages = true;
rpt.ReportPath = String.Concat(Path.GetDirectoryName(Request.PhysicalPath), "\\Reports\\", reportSelector.SelectedValue);
string orientation = (rpt.GetDefaultPageSettings().IsLandscape) ? "landscape" : "portrait";
StringReader formattedReport = Business.reportHelper.FormatReportForTerritory(rpt.ReportPath, orientation, cultureSelector.SelectedValue);
rpt.LoadReportDefinition(formattedReport);
// Add Data Source
rpt.DataSources.Add(new ReportDataSource("InvoiceDataTable", dt));
// Internationlisation: Add uiCulture and Translation Labels
if (reportSelector.SelectedIndex >= 3)
{
Dictionary<string, string> reportLabels = Reports.reportTranslation.translateInvoice(cultureSelector.SelectedValue);
ReportParameterCollection reportParams = new ReportParameterCollection();
reportParams.Add(new ReportParameter("uiCulture", cultureSelector.SelectedValue));
foreach (string key in reportLabels.Keys)
reportParams.Add(new ReportParameter(key, reportLabels[key]));
rpt.SetParameters(reportParams);
}
// Render To Browser
renderPDFToBrowser(rpt.Render("PDF", Business.reportHelper.GetDeviceInfoFromReport(rpt, cultureSelector.SelectedValue, "PDF")));
}
}
示例3: AutoPrintCls
//public AutoPrintCls(ServerReport serverReport)
// : this((Report)serverReport)
//{
// RenderAllServerReportPages(serverReport);
//}
//public AutoPrintCls(LocalReport localReport)
// : this((Report)localReport)
//{
// RenderAllLocalReportPages(localReport);
//}
private AutoPrintCls(LocalReport report)
{
// Set the page settings to the default defined in the report
ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();
// The page settings object will use the default printer unless
// PageSettings.PrinterSettings is changed. This assumes there
// is a default printer.
m_pageSettings = new PageSettings();
m_pageSettings.PaperSize = reportPageSettings.PaperSize;
m_pageSettings.Margins = reportPageSettings.Margins;
}
示例4: GetDeviceInfoFromReport
public static string GetDeviceInfoFromReport(LocalReport rpt, string uiCulture, string format)
{
string strMargins;
string orientation;
//Render overwrites margins defined in RDLC; capture margins in RDLC
ReportPageSettings pageSettings = rpt.GetDefaultPageSettings();
strMargins = String.Concat((Convert.ToDouble(pageSettings.Margins.Top) / 40.0).ToString(), ",", (Convert.ToDouble(pageSettings.Margins.Left) / 40.0).ToString(), ",", (Convert.ToDouble(pageSettings.Margins.Bottom) / 40.0).ToString(), ",", (Convert.ToDouble(pageSettings.Margins.Right) / 40.0).ToString());
//Capture report orientation
orientation = pageSettings.IsLandscape ? "landscape" : "portrait";
return GetDeviceInfo(uiCulture, format, strMargins, orientation);
}
示例5: Render
public byte[] Render(ReportName reportName, IDictionary<string, object[]> dataSources, params ReportParameter[] parameters)
{
var localReport = new LocalReport();
localReport.ReportEmbeddedResource = new ReportResourceResolver().ResolveResource(reportName);
foreach (var dataSource in dataSources)
{
var reportDataSource = new ReportDataSource(dataSource.Key, dataSource.Value);
localReport.DataSources.Add(reportDataSource);
}
if (parameters != null && parameters.Length > 0)
localReport.SetParameters(parameters);
var reportType = "PDF";
var settings = localReport.GetDefaultPageSettings();
var width = settings.IsLandscape ? settings.PaperSize.Height : settings.PaperSize.Width;
var height = settings.IsLandscape ? settings.PaperSize.Width : settings.PaperSize.Height;
var deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>" + width / 100.0m + "in</PageWidth>" +
" <PageHeight>" + height / 100.0m + "in</PageHeight>" +
" <MarginTop>" + settings.Margins.Top / 100.0m + "in</MarginTop>" +
" <MarginLeft>" + settings.Margins.Left / 100.0m + "in</MarginLeft>" +
" <MarginRight>" + settings.Margins.Right / 100.0m + "in</MarginRight>" +
" <MarginBottom>" + settings.Margins.Bottom / 100.0m + "in</MarginBottom>" +
"</DeviceInfo>";
string mimeType;
string encoding;
string fileNameExtension;
Warning[] warnings;
string[] streams;
return localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
}