本文整理汇总了C#中ReportDocument.Export方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.Export方法的具体用法?C# ReportDocument.Export怎么用?C# ReportDocument.Export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportDocument
的用法示例。
在下文中一共展示了ReportDocument.Export方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratePDF
private void GeneratePDF()
{
ReportDocument rpt = new ReportDocument();
switch (cboView.SelectedItem.Value)
{
case "0":
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsDetails.rpt"));
break;
case "1":
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsSummary.rpt"));
break;
}
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\RetailPlus\temp\");
string strFileName = "chartofacc_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".pdf";
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop = rpt.ExportOptions;
SetDataSource(rpt);
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
exportop.ExportFormatType = ExportFormatType.PortableDocFormat;
rpt.Export(); rpt.Close(); rpt.Dispose();
fraViewer.Attributes.Add("src","/RetailPlus/temp/" + strFileName);
}
示例2: Exportar
public void Exportar(string key)
{
try
{
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
string reportPath = "C:\\Reportes\\CRTejTicket_rpt.rpt";
objRpt.Load(reportPath);
ExportOptions crExportOptions = new ExportOptions();
objRpt.SetDataSource(ds.Tables[0]);
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString();
saveFileDialog.Filter = "Document (*.pdf)|*.PDF";
saveFileDialog.FilterIndex = 1;
saveFileDialog.FileName = "Etiqueta.pdf";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
objRpt.ExportToDisk(ExportFormatType.PortableDocFormat, saveFileDialog.FileName); ;
}
crExportOptions = objRpt.ExportOptions;
objRpt.Export();
}
catch (Exception ex)
{
ex.ToString();
}
}
示例3: GeneratePDF
private void GeneratePDF()
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt"));
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\RetailPlus\temp\");
string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".pdf";
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop = rpt.ExportOptions;
SetDataSource(rpt);
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
exportop.ExportFormatType = ExportFormatType.PortableDocFormat;
rpt.Export(); rpt.Close(); rpt.Dispose();
fraViewer.Attributes.Add("src","/RetailPlus/temp/" + strFileName);
}
示例4: ExportarPDF
private void ExportarPDF(ReportDocument rep)
{
String ruta_exportacion;
ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
//ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rep.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf";
exportOpts.DestinationOptions = diskOpts;
rep.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(diskOpts.DiskFileName.ToString());
Response.Flush();
Response.Close();
System.IO.File.Delete(diskOpts.DiskFileName.ToString());
}
示例5: ExportarEXCEL
private void ExportarEXCEL(ReportDocument rep)
{
String ruta_exportacion;
ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
//ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rep.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".xls";
exportOpts.DestinationOptions = diskOpts;
rep.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader ("Content-Disposition", "attachment;filename=Morosidad.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(diskOpts.DiskFileName.ToString());
Response.Flush();
Response.Close();
System.IO.File.Delete(diskOpts.DiskFileName.ToString());
}
示例6: GenerateReport
public static void GenerateReport(string FileName, ReportDocument rpt, System.Web.UI.Control ClientScriptBlockControl, ExportFormatType pvtExportFormatType)
{
try
{
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strFileExtensionName = ".pdf";
switch (pvtExportFormatType)
{
case ExportFormatType.PortableDocFormat: strFileExtensionName = ".pdf"; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; break;
case ExportFormatType.WordForWindows: strFileExtensionName = ".doc"; exportop.ExportFormatType = ExportFormatType.WordForWindows; break;
case ExportFormatType.Excel: strFileExtensionName = ".xls"; exportop.ExportFormatType = ExportFormatType.Excel; break;
}
string strPath = System.Web.HttpContext.Current.Server.MapPath(@"\retailplus\temp\");
string strFileName = FileName + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + strFileExtensionName;
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
rpt.Export(exportop); //rpt.Close(); rpt.Dispose();
// remove the error
if (pvtExportFormatType == ExportFormatType.WordForWindows || pvtExportFormatType == ExportFormatType.Excel || pvtExportFormatType == ExportFormatType.PortableDocFormat)
{
// the maximum report processing jobs limit configured by your system administrator has been reached.
rpt.Close(); rpt.Dispose();
}
if (pvtExportFormatType == ExportFormatType.PortableDocFormat)
{
string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName;
string javaScript = "window.open('" + newWindowUrl + "');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true);
}
else
{
string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName;
string javaScript = "window.open('" + newWindowUrl + "','_self');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true);
//System.Diagnostics.Process p = new System.Diagnostics.Process();
//p.StartInfo.FileName = System.Web.HttpContext.Current.Server.MapPath(Constants.ROOT_DIRECTORY + "/temp/" + strFileName);
//p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
//p.Start();
}
}
catch (Exception ex) { throw ex; }
}
示例7: PrintReport
public void PrintReport(string key)
{
try
{
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
string reportPath = "C:\\Reportes\\CRIngreso_etiqueta02.rpt";
objRpt.Load(reportPath);
DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions();
ExportOptions crExportOptions = new ExportOptions();
objRpt.SetDataSource(ds.Tables[0]);
string strfolder = "C:\\Reporte\\";
crDiskFileDestinationOption.DiskFileName = strfolder + "Etiqueta.pdf";
crExportOptions = objRpt.ExportOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption;
crExportOptions.ExportFormatOptions = crFormatTypeOption;
objRpt.Export();
this.printDialog1.Document = this.printDocument1;
DialogResult dr = this.printDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
PageMargins margins;
margins = objRpt.PrintOptions.PageMargins;
margins.bottomMargin = 250;
margins.leftMargin = 250;
margins.rightMargin = 250;
margins.topMargin = 250;
objRpt.PrintOptions.ApplyPageMargins(margins);
string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
objRpt.PrintOptions.PrinterName = PrinterName;
objRpt.PrintToPrinter(1, false, 0, 0);
}
}
catch (Exception ex)
{
ex.ToString();
}
}
示例8: GeneratePDF
public void GeneratePDF(string poId)
{
ReportDocument rptDoc = new ReportDocument();
dsPSMS ds = new dsPSMS();
DataTable dt = new DataTable();
dt.TableName = "PO";
dt = getAllPOs();
ds.Tables["dtPO"].Merge(dt);
//subreport data table
dt = new DataTable();
dt.TableName = "Terms";
dt = getAllTerms();
ds.Tables["dtTerms"].Merge(dt);
rptDoc.Load(Server.MapPath("~/Reports/crPO.rpt"));
rptDoc.SetDataSource(ds);
string fileName = "PO" + poId + "_.pdf";
String targetFolder = Server.MapPath(POAttachmentfolderPath);
ExportOptions CrExportOptions;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = targetFolder + "\\" + fileName;
CrExportOptions = rptDoc.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
rptDoc.Export();
string strFields = "";
string[] strValues = new string[3];
strFields = "[POID],[FilePath],[Note]";
string filePath = POAttachmentfolderPath + "/" + fileName;
string sqlStr = "select [FilePath] from [dbo].[POAttach] where [FilePath][email protected]";
DataTable hasData = am.DataAccess.RecordSet(sqlStr, new string[] { filePath });
if (hasData.Rows.Count == 0)
{
strValues = new string[] { poId.ToString() , filePath , txtAttachmentNote.Text.Trim() };
am.DataAccess.BatchQuery.Insert("[dbo].[POAttach]", strFields, strValues);
am.DataAccess.BatchQuery.Execute();
}
}
示例9: loadReport
private void loadReport()
{
DataTable lData = ((DataTable)Session["WRK_TABLE"]);
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue dctField = new ParameterDiscreteValue();
if (Session["WRK_TABLE"] != null)
{
if (lData.Rows.Count > 0)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;
myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
myReportDocument.Load(Server.MapPath(hidReportName.Value + ".rpt"));
myReportDocument.SetDataSource(lData);
ExportOptions relExportOptions;
DiskFileDestinationOptions relDiskFileDestinationOptions;
string strPDFTemp = Server.MapPath(@"~\Aut\Reports\Files\" + hidReportName.Value + ".pdf");
relDiskFileDestinationOptions = new DiskFileDestinationOptions();
relDiskFileDestinationOptions.DiskFileName = strPDFTemp;
relExportOptions = myReportDocument.ExportOptions;
relExportOptions.ExportDestinationOptions = relDiskFileDestinationOptions;
relExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
relExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
myReportDocument.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline; filename=ReportName.pdf");
Response.WriteFile(strPDFTemp);
Response.Flush();
Response.Close();
System.IO.File.Delete(strPDFTemp);
}
}
}
示例10: Export
private void Export(ExportFormatType pvtExportFormatType)
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/_StockTransactionReport.rpt"));
SetDataSource(rpt);
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\retailplus\temp\");
string strFileExtensionName = ".pdf";
switch (pvtExportFormatType)
{
case ExportFormatType.PortableDocFormat: strFileExtensionName = ".pdf"; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; break;
case ExportFormatType.WordForWindows: strFileExtensionName = ".doc"; exportop.ExportFormatType = ExportFormatType.WordForWindows; break;
case ExportFormatType.Excel: strFileExtensionName = ".xls"; exportop.ExportFormatType = ExportFormatType.Excel; break;
}
string strFileName = "tranreport_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + strFileExtensionName;
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
rpt.Export(exportop); //rpt.Close(); rpt.Dispose();
if (pvtExportFormatType == ExportFormatType.PortableDocFormat)
{
rpt.Close(); rpt.Dispose();
Response.Redirect(Constants.ROOT_DIRECTORY + "/temp/" + strFileName, false);
}
else
{
CRViewer.ReportSource = rpt;
Session["ReportDocument"] = rpt;
CRSHelper.OpenExportedReport(strFileName); // OpenExportedReport(strFileName);
}
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt;
String sql = "Select * FROM tableAttendance";
SqlCommand com = new SqlCommand(sql, conn);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(com);
dt = new DataTable("dt");
da.Fill(dt);
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("crystalreportforattendance.rpt"));
rpt.SetDatabaseLogon("sa", "yugioh", @"JOP-PC\SQLEXPRESS", "ISAttandaceManagementSystem");
rpt.SetDataSource(dt);
crvattendance.ReportSource = rpt;
MemoryStream oStream;
oStream = (MemoryStream)
rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
//rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Appointment");
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
rpt.Export();
conn.Close();
conn.Dispose();
}
}
示例12: ExportPDF
private void ExportPDF()
{
try
{
lblInfo.Text = "Gerando arquivo pdf para anexo";
DirectoryInfo dinfo = new DirectoryInfo(Server.MapPath("Pedidos"));
if (!dinfo.Exists)
{
dinfo.Create();
}
if (File.Exists(Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf")))
{
File.Delete(Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf"));
}
CarregaDataTableParaImpressao();
ReportDocument rpt = new ReportDocument();
dsPedido TabelaImpressao = (dsPedido)Session["PedidoRes"];
rpt.Load(Server.MapPath("rptPedido.rpt"));
rpt.SetDataSource(TabelaImpressao);
CrystalDecisions.Web.CrystalReportViewer cryView = new CrystalDecisions.Web.CrystalReportViewer();
ExportOptions CrExportOptions;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf");
CrExportOptions = rpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
rpt.Export();
lblInfo.Text = "Exportando arquivo para o servidor";
}
catch (Exception ex)
{
throw ex;
//lblInfo.Text = ex.Message + (ex.InnerException != null ? ex.InnerException.Message : "");
}
}
示例13: muestrareporte
//.........这里部分代码省略.........
dtVoucher.Columns.Add("SimboloMoneda2");
dtVoucher.Columns.Add("EmailEnviaVoucher");
try
{
System.Data.SqlClient.SqlConnection conn;
conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
conn.Open();
SqlCommand command = new SqlCommand("spselImprimeVoucher", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("Id_Operacion", Convert.ToInt32(IdOperacion));
command.ExecuteNonQuery();
adapter = new SqlDataAdapter(command);
adapter.Fill(ds);
conn.Close();
ds.Dispose();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow row = dtVoucher.NewRow();
row["IdOperacion"] = ds.Tables[0].Rows[i]["IdOperacion"].ToString();
row["FechaEmision"] = ds.Tables[0].Rows[i]["FechaEmision"].ToString(); ;
row["NroVoucher"] = ds.Tables[0].Rows[i]["NroVoucher"].ToString();
row["Pasajero_Nombre"] = ds.Tables[0].Rows[i]["Pasajero_Nombre"].ToString();
row["Pasajero_Apellido"] = ds.Tables[0].Rows[i]["Pasajero_Apellido"].ToString();
row["Pasajero_Documento"] = ds.Tables[0].Rows[i]["Pasajero_Documento"].ToString();
row["Pasajero_FechaNac"] = ds.Tables[0].Rows[i]["Pasajero_FechaNac"].ToString();
row["Pasajero_TipoTelefono"] = ds.Tables[0].Rows[i]["Pasajero_TipoTelefono"].ToString();
row["Pasajero_Telefono"] = ds.Tables[0].Rows[i]["Pasajero_Telefono"].ToString();
row["Pasajero_Celular"] = ds.Tables[0].Rows[i]["Pasajero_Celular"].ToString();
row["Pasajero_Email"] = ds.Tables[0].Rows[i]["Pasajero_Email"].ToString();
row["ContactoEmergencia_Apellido"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Apellido"].ToString();
row["ContactoEmergencia_Nombre"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Nombre"].ToString();
row["ContactoEmergencia_Email"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Email"].ToString();
row["ProductoDescripcion"] = ds.Tables[0].Rows[i]["ProductoDescripcion"].ToString();
row["OrigenDescripcion"] = ds.Tables[0].Rows[i]["OrigenDescripcion"].ToString();
row["DestinoDescripcion"] = ds.Tables[0].Rows[i]["DestinoDescripcion"].ToString();
row["FechaPartida"] = ds.Tables[0].Rows[i]["FechaPartida"].ToString();
row["FechaRegreso"] = ds.Tables[0].Rows[i]["FechaRegreso"].ToString();
row["ImporteTarifaPesos"] = ds.Tables[0].Rows[i]["ImporteTarifaPesos"].ToString();
row["ImporteTarifaDolar"] = ds.Tables[0].Rows[i]["ImporteTarifaDolar"].ToString();
row["IdCobertura"] = ds.Tables[0].Rows[i]["IdCobertura"].ToString();
row["DescripcionCobertura"] = ds.Tables[0].Rows[i]["DescripcionCobertura"].ToString();
row["ValorCobertura"] = ds.Tables[0].Rows[i]["ValorCobertura"].ToString();
row["MonedaDescripcion"] = ds.Tables[0].Rows[i]["MonedaDescripcion"].ToString();
row["SimboloMoneda"] = ds.Tables[0].Rows[i]["SimboloMoneda"].ToString();
row["IdCobertura2"] = ds.Tables[0].Rows[i]["IdCobertura2"].ToString();
row["DescripcionCobertura2"] = ds.Tables[0].Rows[i]["DescripcionCobertura2"].ToString();
row["ValorCobertura2"] = ds.Tables[0].Rows[i]["ValorCobertura2"].ToString();
row["MonedaDescripcion2"] = ds.Tables[0].Rows[i]["MonedaDescripcion2"].ToString();
row["SimboloMoneda2"] = ds.Tables[0].Rows[i]["SimboloMoneda2"].ToString();
row["EmailEnviaVoucher"] = ds.Tables[0].Rows[i]["EmailEnviaVoucher"].ToString();
emailenviavoucher = ds.Tables[0].Rows[i]["EmailEnviaVoucher"].ToString();
dtVoucher.Rows.Add(row);
}
ds.Dispose();
dsVoucher.Tables.Add(dtVoucher);
ReportDocument reporte = new ReportDocument(); // creating object of crystal report
reporte.Load(Server.MapPath("~/Reportes/pagoconfirmado.rpt")); // path of report
reporte.SetDataSource(dsVoucher.Tables[0]);
dsVoucher.Dispose();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
reporte.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
reporte.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
archivo = "C:/Data/Tusegurodeviaje/Reports/TempReports/pagoconfirmado_" + IdOperacion + ".pdf";
diskOpts.DiskFileName = archivo;
reporte.ExportOptions.DestinationOptions = diskOpts;
reporte.Export();
//CrystalReportViewer1.ReportSource = reporte;
//reporte.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "pagoconfirmado" + IdOperacion);
enviaemail(archivo, emailenviavoucher);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
}
}
示例14: PrintReport
public void PrintReport(string key)
{
try
{
//----------------------------------------
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
string reportPath = "C:\\Reportes\\CRIngreso_etiqueta02.rpt";
objRpt.Load(reportPath);
DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions();
ExportOptions crExportOptions = new ExportOptions();
objRpt.SetDataSource(ds.Tables[0]);
string strfolder = "C:\\Reporte\\";
crDiskFileDestinationOption.DiskFileName = strfolder + "Etiqueta.pdf";
crExportOptions = objRpt.ExportOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption;
crExportOptions.ExportFormatOptions = crFormatTypeOption;
objRpt.Export();
//---------------------------------------
////string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
//string NombreImpresora = "";
////for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
////{
//// PrinterSettings a = new PrinterSettings();
//// a.PrinterName = PrinterSettings.InstalledPrinters[i].ToString();
//// if (a.IsDefaultPrinter)
//// {
//// PrinterName = PrinterSettings.InstalledPrinters[i].ToString();
//// }
////}
//this.printDialog1.Document = this.printDocument1;
//DialogResult dr = this.printDialog1.ShowDialog();
//if (dr == DialogResult.OK)
// {
PageMargins margins;
margins = objRpt.PrintOptions.PageMargins;
margins.bottomMargin = 250;
margins.leftMargin = 250;
margins.rightMargin = 250;
margins.topMargin = 250;
objRpt.PrintOptions.ApplyPageMargins(margins);
//string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
// ////objRpt.PrintOptions.PrinterName = PrinterName;
objRpt.PrintOptions.PrinterName = GetImpresoraDefecto();
//objRpt.PrintOptions.PrinterName = PrinterName;
objRpt.PrintToPrinter(1, false, 0, 0);
//}
}
catch (Exception ex)
{
ex.ToString();
}
}
示例15: btnPresupuesto_Click
protected void btnPresupuesto_Click(object sender, EventArgs e)
{
/*
DataSet dss = BRBitacora.buscarPorFiltro("","","","","");
DataTable dt = dss.Tables[0];
//dt.Columns.Add("id");
//TransArteReport report = new TransArteReport();
//DataTable _tabla = report.DataTable1;
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("../Reportes/ReportBitacora.rpt"));
rpt.SetDataSource(dt);
*/
ReportDocument rpt = new ReportDocument();
String szFileName = "";
String strServerPath = "";
rpt.PrintOptions.PaperOrientation = PaperOrientation.DefaultPaperOrientation;
rpt.PrintOptions.PaperSize = PaperSize.DefaultPaperSize;
rpt.PrintOptions.PaperSource = PaperSource.Upper;
rpt.PrintOptions.PrinterDuplex = PrinterDuplex.Default;
DataSet dss = BRBitacora.buscarPorFiltro("", "", "", "", "");
DataTable dt = dss.Tables[0];
dt.Columns.Add("Logo", System.Type.GetType("System.Byte[]"));//Agrego la columna con el tipo de dato "System.Byte[]",donde guardare mi imagen.
dt.Rows[0]["Logo"] = CargarImagen("C:\\TransArte\\Website\\images\\logoMini.PNG");//Cargo La imagen
dt.Columns.Add("UsuarioFiltro", System.Type.GetType("System.String"));//Agrego la columna con el tipo de dato "System.Byte[]",donde guardare mi imagen.
dt.Rows[0]["UsuarioFiltro"] = "MAXIMILIANO";//Cargo La imagen
rpt.Load(Server.MapPath("../Reportes/ReportBitacora.rpt"));
rpt.SetDataSource(dt);
szFileName = "bitacora.pdf";
strServerPath = Server.MapPath("~") + "\\Reportes\\";
DiskFileDestinationOptions dfdoFile = new DiskFileDestinationOptions();
dfdoFile.DiskFileName = strServerPath + szFileName;
rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
rpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
rpt.ExportOptions.DestinationOptions = dfdoFile;
rpt.Export();
Response.Redirect("../Reportes/" + szFileName, false);
/*
*
http://localhost:49173/website/Servicio/Reportes.aspx
*
* */
}