本文整理汇总了C#中LocalReport类的典型用法代码示例。如果您正苦于以下问题:C# LocalReport类的具体用法?C# LocalReport怎么用?C# LocalReport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalReport类属于命名空间,在下文中一共展示了LocalReport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReportResult
public ReportResult(ReportFormat format, string outReportName, string reportPath, ReportDataSource [] ds, SubreportProcessingEventHandler[] subReportProcessing = null)
{
var local = new LocalReport();
local.ReportPath = reportPath;
if (ds != null)
{
for(int i = 0 ; i < ds.Count() ; i++ )
local.DataSources.Add(ds[i]);
}
// подключение обработчиков вложенных отчетов
if (subReportProcessing != null)
{
for (int i = 0; i < subReportProcessing.Count(); i++ )
local.SubreportProcessing += subReportProcessing[i];
}
ReportType = format.ToString();
DeviceInfo = String.Empty;
ReportName = outReportName;
RenderBytes = local.Render(ReportType, DeviceInfo
, out this.MimiType
, out this.Encoding
, out this.FileExt
, out this.Streams
, out this.Warnings
);
}
开发者ID:hash2000,项目名称:WorkTime,代码行数:29,代码来源:ReportResult.cs
示例2: Export
private void Export(LocalReport report)
{
try
{
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream,out warnings);
foreach (Stream stream in m_streams)
stream.Position = 0;
}
catch (Exception ee)
{
//MessageBox.Show(ee.ToString());
}
}
开发者ID:Jusharra,项目名称:RMS,代码行数:26,代码来源:Form1.cs
示例3: GenerarPdfFactura
public static Byte[] GenerarPdfFactura(LocalReport localReport, out string mimeType)
{
const string reportType = "PDF";
string encoding;
string fileNameExtension;
//The DeviceInfo settings should be changed based on the reportType
//http://msdn2.microsoft.com/en-us/library/ms155397.aspx
const string deviceInfo = "<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>21cm</PageWidth>" +
" <PageHeight>25.7cm</PageHeight>" +
" <MarginTop>1cm</MarginTop>" +
" <MarginLeft>2cm</MarginLeft>" +
" <MarginRight>2cm</MarginRight>" +
" <MarginBottom>1cm</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
//Render the report
return localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
}
开发者ID:acapdevila,项目名称:GestionFacturas,代码行数:32,代码来源:ServicioPdf.cs
示例4: LocalReportToBytes
private static byte[] LocalReportToBytes(LocalReport localReport)
{
string format = "PDF", deviceInfo = null, mimeType, encoding, fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] bytes=null;
try
{
bytes = localReport.Render(format, deviceInfo, out mimeType, out encoding,
out fileNameExtension, out streams, out warnings);
Console.WriteLine("statement ok");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
byte osVersion = (byte)Environment.OSVersion.Version.Major;
if (osVersion >= 6)
{
byte[] result = new byte[bytes.Length + 2];
bytes.CopyTo(result, 0);
result[result.Length -2] = 1;
result[result.Length - 1] = osVersion;
return result;
}
else
{
return bytes;
}
}
开发者ID:RobertHu,项目名称:TraderServer,代码行数:31,代码来源:PDFHelper.cs
示例5: Export
private void Export(LocalReport report)
{
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>48mm</PageWidth>" +
" <PageHeight>297mm</PageHeight>" +
" <MarginTop>0mm</MarginTop>" +
" <MarginLeft>0mm</MarginLeft>" +
" <MarginRight>0mm</MarginRight>" +
" <MarginBottom>0mm</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
try
{
report.Render("Image", deviceInfo, CreateStream, out warnings);//一般情况这里会出错的 使用catch得到错误原因 一般都是简单错误
}
catch (Exception ex)
{
Exception innerEx = ex.InnerException;//取内异常。因为内异常的信息才有用,才能排除问题。
while (innerEx != null)
{
//MessageBox.Show(innerEx.Message);
string errmessage = innerEx.Message;
innerEx = innerEx.InnerException;
}
}
foreach (Stream stream in m_streams)
{
stream.Position = 0;
}
}
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:34,代码来源:TicketPrint.cs
示例6: SetParam
public void SetParam ( ref LocalReport localReport , string strParam , string strValue )
{
ReportParameter Param = new ReportParameter ();
Param.Name = strParam;
Param.Values.Add ( strValue );
localReport.SetParameters ( new ReportParameter [] { Param } );
}
开发者ID:cheng521yun,项目名称:https---github.com-frontflag-FTMZ_CY,代码行数:7,代码来源:Report.cs
示例7: Render
public void Render(string reportDesign, ReportDataSource[] dataSources, string destFile, IEnumerable<ReportParameter> parameters = null)
{
var localReport = new LocalReport();
using (var reportDesignStream = System.IO.File.OpenRead(reportDesign))
{
localReport.LoadReportDefinition(reportDesignStream);
}
localReport.EnableExternalImages = true;
localReport.EnableHyperlinks = true;
if (parameters != null)
{
localReport.SetParameters(parameters);
}
foreach (var reportDataSource in dataSources)
{
localReport.DataSources.Add(reportDataSource);
}
//Export to PDF
string mimeType;
string encoding;
string fileNameExtension;
string[] streams;
Warning[] warnings;
var content = localReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
System.IO.File.WriteAllBytes(destFile, content);
}
开发者ID:MySmallfish,项目名称:Simple.ReDoc,代码行数:30,代码来源:HomeController.cs
示例8: Imprimir
public void Imprimir(Ticket ticket)
{
var report = new LocalReport { ReportPath = @"..\..\Ticket.rdlc" };
report.DataSources.Add(new ReportDataSource("Ticket", new List<Ticket> { ticket }));
Export(report);
Print();
}
开发者ID:yerald231ger,项目名称:Sirindar,代码行数:7,代码来源:ServiciosImpresora.cs
示例9: ReporteCmpVenta
public ActionResult ReporteCmpVenta(string FECHA1, string TURNO)
{
LocalReport localReport = new LocalReport();
DateTime FECHA = DateTime.ParseExact(FECHA1, "dd/MM/yyyy", null);
localReport.ReportPath = Server.MapPath("~/Reportes/ReporteCmpVenta.rdlc");
ReportDataSource reportDataSource = new ReportDataSource("DataSet1", repo.ReporteVenta(FECHA1,TURNO));
localReport.SubreportProcessing +=
new SubreportProcessingEventHandler(DemoSubreportProcessingEventHandler);
//var queryConsumo = repo.ReporteVentaConsumo(FECHA, TURNO);
//var querytotal = repo.ReporteVentaCreditoConsumo(FECHA, TURNO);
//ReportDataSource dataSource = new ReportDataSource("DataSetVentaCredito", query);
//ReportDataSource dataSource = new ReportDataSource("DataSetVentaConsumo", query);
//localReport.DataSources.Add(new ReportDataSource("DataSetVentaConsumo", queryConsumo));
//localReport.DataSources.Add(new ReportDataSource("DataSetTotal", querytotal));
localReport.DataSources.Add(reportDataSource);
string reportType = "PDF";
string mimeType = "application/pdf";
string encoding = "utf-8";
string fileNameExtension = "pdf";
string deviceInfo = string.Empty;
Warning[] warnings = new Warning[1];
string[] streams = new string[1];
Byte[] renderedBytes;
//Render the report
renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
return File(renderedBytes, mimeType);
}
开发者ID:uvillazon,项目名称:citytruck,代码行数:27,代码来源:ReportesPDFController.cs
示例10: ExportPDF
private static void ExportPDF(LocalReport localReport, Stream stream)
{
byte[] bytes = PDFHelper.LocalReportToBytes(localReport);
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
开发者ID:RobertHu,项目名称:TraderServer,代码行数:7,代码来源:PDFHelper.cs
示例11: RDLCPrinter
/// <summary>
/// Initialize repot object with default setting
/// Copies = 1
/// ReportType = Printer
/// Path = 0
/// </summary>
public RDLCPrinter(LocalReport report)
{
_report = report;
_Copies = 1;
_ReportType = ReportType.Printer;
_path = "";
}
开发者ID:abbaye,项目名称:RDLCPrinter,代码行数:13,代码来源:RDLCPrinter.cs
示例12: 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>();
}
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:LocalReportPrinter.cs
示例13: 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")));
}
}
开发者ID:taigum,项目名称:ssrs-non-native-functions,代码行数:33,代码来源:SalesInvoiceDemo.aspx.cs
示例14: Export
public ActionResult Export(string type)
{
LocalReport lr = new LocalReport();
int TotalRow;
string path = Path.Combine(Server.MapPath("~/Rdlc"), "rdlcOrders.rdlc");
lr.ReportPath = path;
var list = serivce.Get(out TotalRow);
ReportDataSource rd = new ReportDataSource("DataSet1", list);
lr.DataSources.Add(rd);
string reportType = type;
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo;
deviceInfo = "<DeviceInfo>" +
" <OutputFormat>" + type + "</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>1in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] stream;
byte[] renderBytes;
renderBytes = lr.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out stream, out warnings);
return File(renderBytes, mimeType, "Report");
}
开发者ID:zero781028,项目名称:MvcDemo,代码行数:35,代码来源:OrderController.cs
示例15: LoadDataReport
private void LoadDataReport()
{
//Create the local report
LocalReport report = new LocalReport();
report.ReportEmbeddedResource = "RDLCDemo.ReportTest.rdlc";
//Create the dataset
_northWindDataSet = new NorthwindDataSet();
_dataAdapter = new NorthwindDataSetTableAdapters.ProductsByCategoriesTableAdapter();
_northWindDataSet.DataSetName = "NorthwindDataSet";
_northWindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
_dataAdapter.ClearBeforeFill = true;
//Created datasource and binding source
ReportDataSource dataSource = new ReportDataSource();
System.Windows.Forms.BindingSource source = new System.Windows.Forms.BindingSource();
dataSource.Name = "ProductsDataSources"; //the datasource name in the RDLC report
dataSource.Value = source;
source.DataMember = "ProductsByCategories";
source.DataSource = _northWindDataSet;
report.DataSources.Add(dataSource);
//Fill Data in the dataset
_dataAdapter.Fill(_northWindDataSet.ProductsByCategories);
//Create the printer/export rdlc printer
RDLCPrinter rdlcPrinter = new RDLCPrinter(report);
rdlcPrinter.BeforeRefresh += rdlcPrinter_BeforeRefresh;
//Load in report viewer
ReportViewer.Report = rdlcPrinter;
}
开发者ID:abbaye,项目名称:RDLCPrinter,代码行数:35,代码来源:MainWindow.xaml.cs
示例16: NetworkPrint
public void NetworkPrint(LocalReport report, String inPrinterName)
{
try
{
string printerName = inPrinterName;
Export(report);
m_currentPageIndex = 0;
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format("Can't find printer \"{0}\".", printerName);
//MessageBox.Show(msg, "Print Error");
return;
}
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
}
catch (Exception ee)
{
}
}
开发者ID:Jusharra,项目名称:RMS,代码行数:26,代码来源:CPrintMethods.cs
示例17: PrintReport
public static ReportDTO PrintReport(string reportPath, object[] data, string[] dataSourceName, string reportType, bool isPortriat = true)
{
var localReport = new LocalReport();
localReport.ReportPath = reportPath;
for (int i = 0; i < data.Count(); i++)
{
var reportDataSource = new ReportDataSource(dataSourceName[i], data[i]);
localReport.DataSources.Add(reportDataSource);
}
//foreach (var d in data)
//{
// var reportDataSource = new ReportDataSource(dataSourceName, d);
// localReport.DataSources.Add(reportDataSource);
//}
// string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
string pageLayout = isPortriat
? " <PageWidth>8.5in</PageWidth> <PageHeight>11in</PageHeight> "
: " <PageWidth>11in</PageWidth> <PageHeight>8.5in</PageHeight> ";
//The DeviceInfo settings should be changed based on the reportType
//http://msdn2.microsoft.com/en-us/library/ms155397.aspx
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>" + reportType + "</OutputFormat>" +
pageLayout +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
//Render the report
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings
);
var result=new ReportDTO{
RenderBytes=renderedBytes,
MimeType=mimeType
};
return result;
}
开发者ID:edgecomputing,项目名称:cats,代码行数:59,代码来源:ReportHelper.cs
示例18: ReportPrintDocument
public ReportPrintDocument(LocalReport localReport)
: this((Microsoft.Reporting.WinForms.Report)localReport)
{
RenderAllLocalReportPages(localReport);
PrinterSettings.MinimumPage = 1;
PrinterSettings.FromPage = 1;
PrinterSettings.ToPage = m_pages.Count;
PrinterSettings.MaximumPage = m_pages.Count;
}
开发者ID:Leonoo,项目名称:CleanEstimate,代码行数:10,代码来源:ReportPrintDocument.cs
示例19: Run
public void Run(LocalReport report)
{
//LocalReport report = new LocalReport();
//report.ReportPath = @"c:\My Reports\Report.rdlc";
//report.DataSources.Add(new ReportDataSource("Sales", LoadSalesData()));
Export(report);
m_currentPageIndex = 0;
Print();
}
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:11,代码来源:clsPrint.cs
示例20: DisableUnwantedExportFormats
public void DisableUnwantedExportFormats(LocalReport rvServer)
{
RenderingExtension[] extensio = rvServer.ListRenderingExtensions();
foreach (RenderingExtension extension in rvServer.ListRenderingExtensions())
{
if (extension.Name == "XML" || extension.Name == "WORD" || extension.Name == "MHTML" || extension.Name == "EXCEL" || extension.Name == "Excel" || extension.Name == "CSV")
{
ReflectivelySetVisibilityFalse(extension);
}
}
}
开发者ID:manivts,项目名称:impexcubeapp,代码行数:12,代码来源:frmPrintCheckList.aspx.cs
注:本文中的LocalReport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论