获取打印机设置 PrinterSettings settings = workbook.PrintDocument.PrinterSettings; // 4 执行打印 workbook.PrintDocument.Print(); } }}3.2 代码详解加载 Excel 文档Workbook workbook = ;settings.PrinterName = "Your Printer Name";workbook.PrintDocument.Print();获取打印机设置对象,指定目标打印机名称,最后调用 Print = new StandardPrintController();// 设置打印份数workbook.PrintDocument.PrinterSettings.Copies = 2;// 静默执行打印 workbook.PrintDocument.Print();八、异常处理建议在实际应用中加入异常处理:try{ // 检查打印机是否存在 if (!
,无暇思考,万能的谷歌啊
public class Printer
{
private DataGridView dataview;
private PrintDocument summary>
/// <param name="dataview">要打印的DateGridView</param>
/// <param name="printDoc">PrintDocument 用于获取打印机的设置</param>
public Printer(DataGridView dataview, PrintDocument printDoc, string[] footer - 1;
AreaHeight = temptop;
}
/**/
///
/param> private void btnPrint_Click(object sender, EventArgs e) { // printDocument1 为 打印控件 //设置打印用的纸张 当设置为Custom的时候,可以自定义纸张的大小,还可以选择A4,A5等常用纸型 this.printDocument1 .DefaultPageSettings.PaperSize = new PaperSize("Custum", 500, 300); this.printDocument1.PrintPage this.MyPrintDocument_PrintPage); //将写好的格式给打印预览控件以便预览 printPreviewDialog1.Document = printDocument1
/param> private void btnPrint_Click(object sender, EventArgs e) { // printDocument1 为 打印控件 //设置打印用的纸张 当设置为Custom的时候,可以自定义纸张的大小,还可以选择A4,A5等常用纸型 this.printDocument1 .DefaultPageSettings.PaperSize = new PaperSize("Custum", 500, 300); this.printDocument1.PrintPage this.MyPrintDocument_PrintPage); //将写好的格式给打印预览控件以便预览 printPreviewDialog1.Document = printDocument1
printDocument1.PrinterSettings.PrinterName = comboInstalledPrinters.Text; } } /// <param name="sender"></param> /// <param name="e"></param> private void printDocument1 PaperSize pkCustomSize = new PaperSize("Custum", 775, 453); //員工IC卡格式 this.printDocument1 { //System.Drawing.Printing.Duplex System.Drawing.Printing.PrintDocument (printDocument1_PrintPage); pd.Print(); //printDocument1.Print();
ShowDialog() --------------------------------------------------------------- Dim pt As Printing.PrintDocument ShowDialog(Me) --------------------------------------------------------------- Dim pd As Printing.PrintDocument
void printDocument(QPrinter *printer); 打印版式设置 横向打印和纵向打印; 打印方向 Portrait 纵向,Landscape:横向 使用如下函数设置 enum private: void drawTable(QPainter *painter, int no); signals: public slots: private slots: void printDocument QPrintPreviewDialog preview(&printer); connect(&preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(printDocument printer.setOrientation(QPrinter::Portrait); //打印方向 if (printDialog.exec() == QDialog::Accepted) { printDocument -200,m_starty+m_height+2,200,m_rowHeight), Qt::AlignRight, "制表时间:"+dateTime); } void CTestReport::printDocument
SingleResultCallback<Document> printDocument = new SingleResultCallback<Document>() { @Override 例如,如果我们想查找 key为“i” ,value为71 的 document,我们要按下面的方法做(重用 printDocument 回调)。 collection.find(exists("i")).sort(descending("i")).first(printDocument); 投射域 有时我们不需要将所有的数据都存在一个 document collection.find().projection(excludeId()).first(printDocument); 聚合 有时,我们需要将存储在 MongoDB 中的数据聚合。 collection.aggregate(singletonList(group(null, sum("total", "$i")))).first(printDocument); 注意 当前,还没有专门用于
自己处理一下~ public class PrintDialogWithPageRange:PrintDialog { public new void PrintDocument if (this.PageRangeSelection == PageRangeSelection.AllPages) { base.PrintDocument
summary> /// <param name="sender"></param> /// <param name="e"></param> private void printDocument1 PrintPage(object sender, PrintPageEventArgs e) { try { // printDocument1 (int)(216 * 100 / 25.4 + 1); int height = (int)(97 * 100 / 25.4 + 1); //this.printDocument1 storePageSetting = new PageSettings();//实列化一个对PageSettings对象 //foreach (PaperSize ps in printDocument1 .DefaultPageSettings.Landscape = false;// //this.printDocument1.DefaultPageSettings.PaperSize
*;其中:Document:用于加载 Word 文档;PrintDocument:Spire.Doc 提供的打印对象;PrinterJob:Java 标准打印任务对象;PageFormat doc = new Document(); doc.loadFromFile("data/report.docx"); // 获取打印对象 PrintDocument doc = new Document(); doc.loadFromFile("data/report.docx"); // 获取打印对象 PrintDocument 选择合适的打印方法场景推荐方法简单快速打印document.getPrintDocument().print()需要精确控制使用 PrinterJob API自定义纸张使用 PrintDocument + PaperSize双面打印使用 PrintDocument + Duplex批量打印循环 + 资源管理5.
param name="PrinterName">打印机名称</param> private void Print2(string PDFPath, string PrinterName) { PrintDocument pd = new PrintDocument(); Process p = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo
1、PrintDocument类 PrintDocument组件用于设置一些属性,这些属性说明在基于Windows操作系统的应用程序中要打印什么内容以及打印文档的能力,可将它与PrintDialog组件一起使用来控制文档打印的各个方面 ,PrintDocument是最重的Windows打印对象,负责建立和其它打印对象的联系,该组件的常用属性及方法如下: 2、PrintPreviewDialog组件常用属性及方法 属性及方法 说明 DefalultPageSetting “打印到文件“复选框 AllowSelection(属性) 获取或设置一个值,该值指示是否启用“页“选项按钮 Document(属性) 获获取或设置一个值,指示用于获取PrinterSetting类的PrintDocument PrintDocument1 设置要打印的文档 PrintPreviewDialog PrintPreviewDialog1 显示“打印预览“窗口 PrintDialog PrintDialog1 显示 “打印“窗口 主要程序代码: Private void printDocument1_PrintPage(objectsender,System.Drawing.PrintPageEventArgs
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument(); doc.LoadFromFile(FileName); PaperSize p = null; //实例化一个PrintDocument 对象来获取当前打印机的纸盒信息 PrintDocument printDoc = new PrintDocument(); //遍历打印机纸盒里面的纸张,找到需要的A3 foreach (PaperSize
DocumentEditor { void createDocument(); void openDocument(); void saveDocument(); void printDocument openDocument(); } interface Savable { void saveDocument(); } interface Printable { void printDocument
sclServiceController 14 tmrTimer 印刷 1 psd PageSetupDialog 2 prd PrintDialog 3 pdc PrintDocument
(ds_ks.Text) pdf.PrintToPage = pdf_page - Val(ds_js.Text) End If pdf.PrinterName = pt_list.Text pdf.PrintDocument.Print Return True End If End FunctionSub get_pt() ''获取打印机列表 On Error Resume Next Dim prtdoc As New PrintDocument
printDialog1.ShowDialog(); //设置打印文档 4 printPreviewDialog1.Document = this.printDocument1 800); 7 printPreviewDialog1.ShowDialog(); 8 } 9 10 private void printDocument1
{
///
2007"; 89 if (m_streams == null || m_streams.Count == 0) 90 return; 91 PrintDocument printDoc = new PrintDocument(); 92 // string aa = printDoc.PrinterSettings.PrinterName; 93