本文整理汇总了C#中System.Windows.Forms.Document.Print方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Print方法的具体用法?C# Document.Print怎么用?C# Document.Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Print方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintMau
void PrintMau(DataRow drData)
{
try
{
List<string> fieldNames = new List<string>() {"TEN_SO_YTE", "TEN_BENHVIEN", "DIACHI_BENHVIEN",
"DIENTHOAI_BENHVIEN", "MA_LUOTKHAM", "ID_BENHNHAN", "TEN_BENHNHAN", "DIA_CHI", "DOITUONG_KCB",
"NOI_CHIDINH", "CHANDOAN", "ID_PHIEU","ten_chitietdichvu", "NAMSINH", "TUOI", "GIOI_TINH",
"MATHE_BHYT", "Ket_qua", "KET_LUAN", "DE_NGHI", "NGAYTHANGNAM","imgPath1","imgPath2","imgPath3","imgPath4"};
List<string> Values = new List<string>() { globalVariables.ParentBranch_Name, globalVariables.Branch_Name, globalVariables.Branch_Address,
globalVariables.Branch_Phone,Utility.sDbnull( drData["MA_LUOTKHAM"],""),Utility.sDbnull( drData["ID_BENHNHAN"],""),Utility.sDbnull( drData["TEN_BENHNHAN"],""),
Utility.sDbnull( drData["dia_chi"],""),Utility.sDbnull( drData["ten_doituong_kcb"],""),Utility.sDbnull( drData["ten_phongchidinh"],""),Utility.sDbnull( drData["Chan_doan"],""),
Utility.sDbnull( drData["id_chidinh"],""),Utility.sDbnull( drData["ten_chitietdichvu"],""),Utility.sDbnull( drData["nam_sinh"],""),Utility.sDbnull( drData["Tuoi"],""),Utility.sDbnull( drData["gioi_tinh"],""),
Utility.sDbnull( drData["mathe_bhyt"],""),"","",
"",Utility.FormatDateTime(globalVariables.SysDate),Utility.sDbnull( drData["Local1"],""),Utility.sDbnull( drData["Local2"],""),
Utility.sDbnull( drData["Local3"],""),
Utility.sDbnull( drData["Local4"],"")};
DmucDichvuclsChitiet objDichvuchitiet = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(txtIdDichvuChitiet.Text, -1));
if (objDichvuchitiet == null)
{
Utility.ShowMsg("Không lấy được thông tin dịch vụ CĐHA từ chi tiết chỉ định");
return;
}
DataTable dtDynamicValues = clsHinhanh.GetDynamicFieldsValues(objDichvuchitiet.IdChitietdichvu, objDichvuchitiet.Bodypart, objDichvuchitiet.ViewPosition, -1, Utility.Int32Dbnull(txtidchidinhchitiet.Text, -1));
foreach (DataRow dr in dtDynamicValues.Rows)
{
string SCode = Utility.sDbnull(dr[DynamicValue.Columns.Ma], "");
//string SName = Utility.sDbnull(dr[DynamicValue.Columns.mota], "");
string SValue = Utility.sDbnull(dr[DynamicValue.Columns.Giatri], "");
fieldNames.Add(SCode);
Values.Add(string.Format("{0}", SValue));
//Values.Add(string.Format("{0}{1}", SName, SValue));
}
string maubaocao = Application.StartupPath + @"\MauCDHA\" + docChuan;
if (!File.Exists(maubaocao))
{
Utility.ShowMsg("Chưa có mẫu báo cáo cho dịch vụ đang chọn. Bạn cần tạo mẫu và nhấn nút chọn mẫu để cập nhật cho dịch vụ đang thực hiện");
cmdBrowseMauChuan.Focus();
return;
}
string fileKetqua = string.Format("{0}{1}{2}{3}{4}", Path.GetDirectoryName(maubaocao), Path.DirectorySeparatorChar, Path.GetFileNameWithoutExtension(maubaocao), "_ketqua", Path.GetExtension(maubaocao));
if ((drData != null) && File.Exists(maubaocao))
{
doc = new Document(maubaocao);
if (doc == null)
{
Utility.ShowMsg("Không nạp được file word.");
return;
}
doc.MailMerge.MergeImageField += MailMerge_MergeImageField;
doc.MailMerge.MergeField += MailMerge_MergeField;
doc.MailMerge.Execute(fieldNames.ToArray(), Values.ToArray());
if (File.Exists(fileKetqua))
{
File.Delete(fileKetqua);
}
doc.Save(fileKetqua, SaveFormat.Doc);
string path = fileKetqua;
if (chkPreview.Checked)
{
if (File.Exists(path))
{
Process process = new Process();
try
{
process.StartInfo.FileName = path;
process.Start();
process.WaitForInputIdle();
}
catch
{
}
}
}
else
{
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.DefaultPageSettings.Margins.Top = 0;
printerSettings.Copies = 1;
doc.Print(printerSettings);
}
}
else
{
MessageBox.Show("Không tìm thấy biểu mẫu", "TThông báo", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
catch (Exception ex)
{
}
}
示例2: PrintToNamedPrinter
public void PrintToNamedPrinter()
{
//ExStart
//ExFor:Document.Print(String)
//ExSummary:Prints the whole document to a specified printer.
Document doc = new Document(MyDir + "Document.doc");
doc.Print("KONICA MINOLTA magicolor 2400W");
//ExEnd
}
示例3: PrintRange
public void PrintRange()
{
//ExStart
//ExFor:Document.Print(PrinterSettings)
//ExSummary:Prints a range of pages.
Document doc = new Document(MyDir + "Rendering.doc");
PrinterSettings printerSettings = new PrinterSettings();
// Page numbers in the .NET printing framework are 1-based.
printerSettings.FromPage = 1;
printerSettings.ToPage = 3;
doc.Print(printerSettings);
//ExEnd
}
示例4: PrintRangeWithDocumentName
public void PrintRangeWithDocumentName()
{
//ExStart
//ExFor:Document.Print(PrinterSettings, String)
//ExSummary:Prints a range of pages along with the name of the document.
Document doc = new Document(MyDir + "Rendering.doc");
PrinterSettings printerSettings = new PrinterSettings();
// Page numbers in the .NET printing framework are 1-based.
printerSettings.FromPage = 1;
printerSettings.ToPage = 3;
doc.Print(printerSettings, "My Print Document.doc");
//ExEnd
}
示例5: Print
public void Print()
{
//ExStart
//ExFor:Document.Print
//ExSummary:Prints the whole document to the default printer.
Document doc = new Document(MyDir + "Document.doc");
doc.Print();
//ExEnd
}