本文整理汇总了C#中ReportDocument.PrintToPrinter方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.PrintToPrinter方法的具体用法?C# ReportDocument.PrintToPrinter怎么用?C# ReportDocument.PrintToPrinter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportDocument
的用法示例。
在下文中一共展示了ReportDocument.PrintToPrinter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnPrint_Click
protected void btnPrint_Click(object sender, EventArgs e)
{
ReportDocument crystalReport = new ReportDocument();
if (ddlExamination.SelectedIndex == 1)
{
//Load crystal report made in design view
crystalReport.Load(Server.MapPath("Reports/BestALResults.rpt"));
}
else if (ddlExamination.SelectedIndex == 2)
{
crystalReport.Load(Server.MapPath("Reports/BestALResults.rpt"));
}
//Set DataBase Login Info
crystalReport.SetDatabaseLogon("root", "123", @"localhost", "nsis");
//Provide parameter values
crystalReport.SetParameterValue("year", int.Parse(ddlYear.SelectedValue.ToString()));
crystalReport.PrintToPrinter(1, true, 1, 2);
}
示例2: PrintReceipt
public static void PrintReceipt(string salesOrderNo)
{
try
{
string receiptPath = factory.MasterDataBroker.GetReceiptPath();
if (string.IsNullOrEmpty(receiptPath))
return;
ReportDocument receipt = new ReportDocument();
receipt.Load(receiptPath);
string conString = BMResto.BO.General.ConnectionHelper.BMRestoConnectionString;
string[] conStringDetails = conString.Split(';');
string server = conStringDetails.SingleOrDefault(o => o.Contains("Data Source")).Split('=')[1];
string db = conStringDetails.SingleOrDefault(o => o.Contains("Initial Catalog")).Split('=')[1];
string userName = conStringDetails.SingleOrDefault(o => o.Contains("User ID")).Split('=')[1];
string password = conStringDetails.SingleOrDefault(o => o.Contains("Password")).Split('=')[1];
receipt.SetDatabaseLogon(userName, password, server, db);
foreach (CrystalDecisions.CrystalReports.Engine.Table table in receipt.Database.Tables)
{
TableLogOnInfo logOnInfo = table.LogOnInfo;
if (logOnInfo != null)
{
logOnInfo.TableName = table.Name;
logOnInfo.ConnectionInfo.DatabaseName = db;
logOnInfo.ConnectionInfo.Password = password;
logOnInfo.ConnectionInfo.UserID = userName;
logOnInfo.ConnectionInfo.ServerName = server;
table.ApplyLogOnInfo(logOnInfo);
}
}
// order no
ParameterDiscreteValue pfDiscrete = new CrystalDecisions.Shared.ParameterDiscreteValue();
pfDiscrete.Value = salesOrderNo;
SetParameterValue("orderNo", receipt, pfDiscrete);
// cashier
ParameterDiscreteValue pfCashier = new CrystalDecisions.Shared.ParameterDiscreteValue();
pfCashier.Value = MembershipHelper.CurrentUserName;
SetParameterValue("cashier", receipt, pfCashier);
receipt.PrintToPrinter(1, false, 0, 1);
}
catch
{
throw;
}
}
示例3: PrintWithCRLayout
/// <summary>
/// Prints the with CR layout.
/// </summary>
/// <param name="nomor">The nomor.</param>
/// <param name="loket">The loket.</param>
/// <param name="copies">The copies.</param>
/// <param name="sender">The sender.</param>
public static void PrintWithCRLayout(string nomor, string loket, int copies, IWin32Window sender)
{
using (var f = new QWaitingWidget("Sedang proses mencetak, tunggu sejenak"))
{
// show PROGRESS
f.Show(sender);
Application.DoEvents();
// load REPORT FILES
var crDocument = new ReportDocument();
crDocument.Load(Application.StartupPath + "/Reports/PrintNomor.Rpt");
crDocument.DataDefinition.FormulaFields["nomor"].Text =
(char)34 + nomor + (char)34;
crDocument.DataDefinition.FormulaFields["loket"].Text =
(char)34 + loket + (char)34;
// get company profile
var db = new CompanyBase();
List<Company> companies = db.GetAll();
db.Dispose();
if (companies != null)
{
crDocument.DataDefinition.FormulaFields["companyname"].Text =
(char)34 + companies[0].CompanyName + (char)34;
crDocument.DataDefinition.FormulaFields["phone"].Text =
(char)34 + companies[0].Phone + (char)34;
crDocument.DataDefinition.FormulaFields["email"].Text =
(char)34 + companies[0].Email + (char)34;
}
try
{
// Get Default Printer Name
var pname = new StringBuilder(255);
int length = 255;
Printer.GetDefaultPrinter(pname, ref length);
// start PRINTING
crDocument.PrintOptions.PrinterName = pname.ToString().Trim();
crDocument.PrintToPrinter(copies, false, 1, 1);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, @"Error !",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("~/Report/rptA6_SchoolFee_WhenPay.rpt"));
//txtNgayThang
CrystalDecisions.CrystalReports.Engine.TextObject txtNgayThang;
txtNgayThang = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtNgayThang"];
txtNgayThang.Text = Session["txtNgayThang"].ToString();
//txtHoTen
CrystalDecisions.CrystalReports.Engine.TextObject txtHoTen;
txtHoTen = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtHoTen"];
txtHoTen.Text = Session["txtHoTen"].ToString();
//txtDiaChi
CrystalDecisions.CrystalReports.Engine.TextObject txtDiaChi;
txtDiaChi = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtDiaChi"];
txtDiaChi.Text = Session["txtDiaChi"].ToString();
//txtNoiDungThu
CrystalDecisions.CrystalReports.Engine.TextObject txtNoiDungThu;
txtNoiDungThu = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtNoiDungThu"];
txtNoiDungThu.Text = Session["txtNoiDungThu"].ToString();
//txtSoTien
CrystalDecisions.CrystalReports.Engine.TextObject txtSoTien;
txtSoTien = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtSoTien"];
txtSoTien.Text = Session["txtSoTien"].ToString();
//txtBangChu
CrystalDecisions.CrystalReports.Engine.TextObject txtBangChu;
txtBangChu = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalReport.ReportDefinition.ReportObjects["txtBangChu"];
txtBangChu.Text = Session["txtBangChu"].ToString();
CrystalReportViewer1.ReportSource = crystalReport;
CrystalReportViewer1.ReportSource = crystalReport;
CrystalReportViewer1.SeparatePages = false;
crystalReport.PrintToPrinter(1, false, 1, 0);
//}
}
示例5: Print
public static bool Print(string reportName, int copies, List<KeyValuePair<string, object>> Param_Values)
{
ReportDocument _reportDocument = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
bool status = false;
_reportDocument.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\Reports\\" + reportName);
string[] LoginData = ConfigurationManager.ConnectionStrings["Production"].ConnectionString.ToString().Split(';');
if (!string.IsNullOrEmpty(LoginData[3].ToString()) && LoginData[3].ToString() != "")
crConnectionInfo.Password = LoginData[3].Split('=')[1].ToString();
crConnectionInfo.UserID = LoginData[2].Split('=')[1].ToString();
crConnectionInfo.DatabaseName = LoginData[1].Split('=')[1];
crConnectionInfo.ServerName = LoginData[0].Split('=')[1];
CrTables = _reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
_reportDocument.Refresh();
// set report Parameter
if (Param_Values != null)
{
foreach (KeyValuePair<string, object> Param_Value in Param_Values)
{
// _reportDocument.SetParameterValue("SalesHeaderID",Param_Value.Value);
_reportDocument.SetParameterValue((string)Param_Value.Key, (object)Param_Value.Value);
}
}
for (int i = 0; i < copies; i++)
{
_reportDocument.PrintToPrinter(1, true, 0, 0);
status = true;
}
return status;
}
示例6: dbFillPrint
public void dbFillPrint(string statement)
{
string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='" + dbP + "';";
dbConn = new MySqlConnection(sConnection);
MySqlCommand dbCmd = new MySqlCommand();
dbConn.Open();
string sql = statement;
dbCmd.CommandText = sql;
dbCmd.CommandTimeout = 45;
dbCmd.Connection = dbConn;
dbCmd.ExecuteNonQuery();
dbReader = dbCmd.ExecuteReader();
MySqlConnection con = new MySqlConnection(sConnection);
con.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter(sql, con);
MySqlDataAdapter Subadapter = new MySqlDataAdapter(sql, con);
ReportDocument cryRpt = new ReportDocument();
ItemsReceipt ds = new ItemsReceipt();
adapter.Fill(ds.Tables[0]);
if (type == "rec")
{
cryRpt.Load(Application.StartupPath.ToString() + "//Reports/Receipt.rpt");
}
else
{
cryRpt.Load(Application.StartupPath.ToString() + "//Reports/ReceiptVoid.rpt");
}
cryRpt.SetDataSource(ds.Tables[0]);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.RefreshReport();
cryRpt.PrintToPrinter(1, false, 1, 1);
}
示例7: ToolBar1_ButtonClick
//.........这里部分代码省略.........
else
{
MessageBox.Show("您没有删除菜品的权限。");
return;
}
}
break;
case 15: //消费单
if (CurrentTableNo != "")
{
if (MessageBox.Show("确定要打印当前桌台所有消费单据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//获取当前桌台所有单据
//遍历每一个单据,获取当前单据的所有菜品信息
Cursor = Cursors.WaitCursor;
string sqlstr;
sqlstr = "SELECT * from view_salebillsfoods_t where tableno='" + CurrentTableNo + "' order by tableno,billno,foodname";
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues;
ParameterDiscreteValue crParameterDiscreteValue;
ReportDocument cr_salebillsfoods = new ReportDocument();
//检测报表文件是否存在
if (File.Exists(rms_var.GetReportPath() + report_var.BalanceQry_rpt_filename))
{
cr_salebillsfoods = report_var.LoadReport(rms_var.GetReportPath() + report_var.SaleBillsFoods_rpt_filename, sqlstr, "view_salebillsfoods_t");
}
else
{
MessageBox.Show("报表文件不存在,请检查系统初始化中的设置是否正确。如果问题依然存在,请联系系统供应商。");
return;
}
crParameterFieldDefinitions = cr_salebillsfoods.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["酒店名称"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = rms_var.GetSysSetup("CompanyName");
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterFieldDefinition = crParameterFieldDefinitions["酒店地址"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = rms_var.GetSysSetup("address");
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterFieldDefinition = crParameterFieldDefinitions["酒店电话"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = rms_var.GetSysSetup("telphone");
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
Cursor = Cursors.Default;
cr_salebillsfoods.PrintToPrinter(1, true, 1, 1);
}
}
break;
case 16: //结账
DoPay();
break;
case 18: //返位
if (rms_var.TheAppExt.Chk_op_fw)
{
frmBacktable frmbt = new frmBacktable();
frmbt.ShowDialog();
if (frmbt.DialogResult == DialogResult.OK)
{
GetTableList(cbTableType.Text);
CurrentTableNo = dgTableStatus[dgTableStatus.CurrentRowIndex, 0].ToString();
GetTableBills(CurrentTableNo);
ShowBill(CurrentTableNo, "first");
}
frmbt.Dispose();
}
else
{
MessageBox.Show("您没有返位权!");
return;
}
break;
case 20:
try
{
rms_var.frmTableST.RefreshTable();
}
catch { }
this.Close();
break;
}
}
示例8: 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();
}
}
示例9: PrintReport
public void PrintReport(string key)
{
try
{
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
//string reportPath = Application.StartupPath + "\\Reporte\\co_ordenCompra_rpt.rpt";
string reportPath = "C:\\Reportes\\co_ordenCompra_rpt.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 + txtOc.Text + ".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)
{
int ncopy = this.printDocument1.PrinterSettings.Copies;
int npage = this.printDocument1.PrinterSettings.FromPage;
int epage = this.printDocument1.PrinterSettings.ToPage;
string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
objRpt.PrintOptions.PrinterName = PrinterName;
objRpt.PrintToPrinter(ncopy, false, npage, epage);
}
}
catch (Exception ex)
{
}
}
示例10: INPHIEU_XETNGHIEM
//.........这里部分代码省略.........
Utility.ShowMsg("Không tìm thấy bản ghi nào", "Thông báo");
return;
}
ProcessData(ref DTPrint);
if (SysPara.IsNormalResult == 1)
{
string normalLevel = Utility.Int32Dbnull(DTPrint.Rows[0]["Sex"], 1) == 1
? "Normal_Level"
: "Normal_LevelW";
ProcessNormalResult(ref DTPrint);
//ProcessNormalResult(ref DTPrint, "Test_result", normalLevel, -1, 1, 0,
// "binhthuong", false);
foreach (DataRow row in DTPrint.Rows)
{
if (
(row["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM"))
|| (row["Test_result"].ToString().Trim().ToUpper().Contains("AM"))
)
{
row["binhthuong"] = -1;
}
else if (
(row["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ"))
|| (row["Test_result"].ToString().Trim().ToUpper().Contains("DUO"))
)
{
row["binhthuong"] = 1;
}
}
}
//try
//{
// reporttype = File.ReadAllText(filereporttype);
// if (chkA5.Checked)
// {
// StrCode = reporttype;
// }
// else if (chkA4.Checked)
// {
// StrCode = reporttype;
// }
//}
//catch (Exception ex)
//{
// MessageBox.Show("Loz" + ex, "Thông báo");
//}
string tieude = "", reportname = "";
var crpt =new ReportDocument();
if (chkPrintXN.Checked)
{
crpt = Utility.GetReport("crpt_InPhieuKetQuaXetNghiem", ref tieude, ref reportname);
}
else if(chkPrintOther.Checked)
{
crpt = Utility.GetReport("crpt_InPhieuXNKhac", ref tieude, ref reportname);
}
if (crpt.FilePath != null &&crpt.FilePath!="")
{
var objForm = new frmPrintPreview(sTitleReport, crpt, true, DTPrint.Rows.Count <= 0 ? false : true);
Utility.UpdateLogotoDatatable(ref DTPrint);
try
{
DTPrint.AcceptChanges();
crpt.SetDataSource(DTPrint);
objForm.crptViewer.ReportSource = crpt;
////crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " PHÒNG TIẾP ĐÓN ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
objForm.crptTrinhKyName = Path.GetFileName(reportname);
Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
Utility.SetParameterValue(crpt, "sCurrentDate", Date(NgayIn));
Utility.SetParameterValue(crpt, "sTitleReport", _myProperties.TieuDeInXNKhac);
Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
if (IsQuick)
{
objForm.ShowDialog();
// Utility.DefaultNow(this);
}
else
{
objForm.addTrinhKy_OnFormLoad();
crpt.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
crpt.PrintToPrinter(0, true, 0, 0);
crpt.Dispose();
CleanTemporaryFolders();
}
}
catch (Exception ex)
{
if (globalVariables.IsAdmin)
{
Utility.ShowMsg(ex.ToString());
}
}
}
else
{
Utility.ShowMsg("Ban hay chon loai mau bao cao","Thong bao");
}
}
示例11: LAOKHOA_InPhieuKhambenh_DV
private void LAOKHOA_InPhieuKhambenh_DV(DataTable m_dtReport, string sTitleReport, string KhoGiay)
{
var crpt = new ReportDocument();
string path = "";
switch (KhoGiay)
{
case "A4":
path = Utility.sDbnull(SystemReports.GetPathReport("PHIEU_KHAM_DV_A4"));
break;
case "A5":
path = Utility.sDbnull(SystemReports.GetPathReport("PHIEU_KHAM_DV_A5"));
// crpt = new CRPT_BAOCAO_PHIEUKHAMBENH_DICHVU_A5();
break;
default:
path = Utility.sDbnull(SystemReports.GetPathReport("PHIEU_KHAM_DV_A4"));
break;
}
if (File.Exists(path))
{
crpt.Load(path);
}
else
{
Utility.ShowMsg(string.Format("Không tìm thấy File {0}", path), "Thông báo không tìm thấy File",
MessageBoxIcon.Warning);
return;
}
// var crpt = reportDocument;
var objForm = new frmPrintPreview(sTitleReport, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
try
{
m_dtReport.AcceptChanges();
crpt.SetDataSource(m_dtReport);
objForm.crptViewer.ReportSource = crpt;
objForm.crptTrinhKyName = Path.GetFileName(path);
crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) +
" PHÒNG TIẾP ĐÓN ".Replace("#$X$#",
Strings.Chr(34) + "&Chr(13)&" +
Strings.Chr(34)) + Strings.Chr(34);
crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
crpt.SetParameterValue("Address", globalVariables.Branch_Address);
crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
crpt.SetParameterValue("CurrentDate", Utility.FormatDateTime(BusinessHelper.GetSysDateTime()));
crpt.SetParameterValue("sTitleReport", sTitleReport);
crpt.SetParameterValue("BottomCondition", BusinessHelper.BottomCondition());
crpt.PrintOptions.PrinterName = _hisPrintProperties.Tenmayinphieukham;
crpt.PrintToPrinter(1, false, 0, 0);
}
catch (Exception ex)
{
if (globalVariables.IsAdmin)
{
Utility.ShowMsg(ex.ToString());
}
}
}
示例12: SendStockCheckPrint
/// <summary>
/// 打印盘点单
/// </summary>
public void SendStockCheckPrint()
{
ReportDocument rptDocument = new ReportDocument();
rptDocument.Load(HttpContext.Current.Server.MapPath("~/CrReport/Rpt_Stock_Check.rpt"));
System.Data.DataTable dt = new System.Data.DataTable();
QX.BLL.Bll_Comm comInstance = new QX.BLL.Bll_Comm();
dt = comInstance.ListViewData("select * from VRpt_StockCheck");
rptDocument.SetDataSource(dt);
rptDocument.PrintToPrinter(1, false, 0, 0); //开始打印所有页
}
示例13: 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();
}
}
示例14: ImprimirReporte
public static void ImprimirReporte(string sTitulo, string nombrereporte, DataTable Dt, params string[] matriz)
{
Frm_Sis_ReportesView forma = new Frm_Sis_ReportesView();
ReportDocument rpt = new ReportDocument();
try
{
string rutaRpt = Helper.fRutaReporte();
rpt.Load(rutaRpt + nombrereporte + ".rpt", OpenReportMethod.OpenReportByDefault);
rpt.SetDataSource(Dt);
for (int c = 0; c < matriz.Length; c++)
{
rpt.DataDefinition.FormulaFields[c].Text = "'" + matriz[c].ToString() + "'";
}
rpt.PrintToPrinter(2,true,1,1);
//forma.Report.ReportSource = rpt;
//forma.Text = sTitulo;
//forma.ShowDialog();
//forma.Dispose();
rpt.Dispose();
}
catch (Exception ex) { throw ex; }
finally { forma = null; rpt = null; }
}
示例15: AutoPrintReport
private void AutoPrintReport(string printerName, String reportFileURL)
{
//PageMargins margins;
ReportDocument Report = new ReportDocument();
//VehicleInputTicket ticket = new VehicleInputTicket();
//ticket.ExportToDisk(ExportFormatType.CrystalReport, "VehicleTicket.rpt");
Report.Load(reportFileURL);
// Select the printer.
Report.PrintOptions.PrinterName = printerName;
// Print the report. Set the startPageN and endPageN
// parameters to 0 to print all pages.
Report.PrintToPrinter(1, false, 0, 0);
}