c# C/S 怎么打印选择的word文档 网上找了很多。使用IO读出来。一行行的画进去打印。但WORD里面有表格啊! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接调用Word//要添加Word的引用object nothing = System.Reflection.Missing.Value; //Word文档路径 object filename = @"C:\ProductERP\" + ID.ToString() + ".docx"; Word.ApplicationClass ap = new Word.ApplicationClass(); Word.Document doc = ap.Documents.Open(ref filename, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing); ap.Visible = true; 我得到这个WORD 怎么交给打印控件 PrintDocument ? 不知道 你是不是非要用PrintDocument 打印ap.Visible word就打开了 可以直接利用Word打印 现在的WORD文档就是生成的。现在需求要求加入打印。 不打开文档的情况下开始打印。如果直接用PrintDocument 去画。 可以实现。但是word表数量居多。而且格式不固定。 public void PrintOut() { object copies = "1"; object pages = ""; object range = WdPrintOutRange.wdPrintAllDocument; object items = WdPrintOutItem.wdPrintDocumentContent; object pageType = WdPrintOutPages.wdPrintAllPages; object oTrue = false; object oFalse = false; this.m_Document.PrintOut( ref oTrue, ref oFalse, ref range, ref missing, ref missing, ref missing, ref items, ref copies, ref pages, ref pageType, ref oFalse, ref oTrue, ref missing, ref oFalse, ref missing, ref missing, ref missing, ref missing); }使用编辑器 非常奇怪的问题,寻求解决方案 WPF中怎么让ListBox中的控件水平布局? 取得 PictureBox显示的图片路径 API打印问题采用(StartDoc,StartPage)进行打印-1500分求解 RDLC报表中统计分组数据用什么表达式 javascript实现当按"回车"时,相当于调用页面上的button按扭的Onclick事件如何写? vs2005 excel保存路径问题 将excel中的数据导入Griedview 关于在C#中取得当期月的月初和月末的日期问题 c#把HTML转换为XML格式 帮忙改个正则。谢谢
object nothing = System.Reflection.Missing.Value;
//Word文档路径
object filename = @"C:\ProductERP\" + ID.ToString() + ".docx";
Word.ApplicationClass ap = new Word.ApplicationClass();
Word.Document doc = ap.Documents.Open(ref filename, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing);
ap.Visible = true;
我得到这个WORD 怎么交给打印控件 PrintDocument ?
ap.Visible word就打开了 可以直接利用Word打印
如果直接用PrintDocument 去画。 可以实现。但是word表数量居多。而且格式不固定。
{
object copies = "1";
object pages = "";
object range = WdPrintOutRange.wdPrintAllDocument;
object items = WdPrintOutItem.wdPrintDocumentContent;
object pageType = WdPrintOutPages.wdPrintAllPages;
object oTrue = false;
object oFalse = false;
this.m_Document.PrintOut(
ref oTrue, ref oFalse, ref range, ref missing, ref missing, ref missing,
ref items, ref copies, ref pages, ref pageType, ref oFalse, ref oTrue,
ref missing, ref oFalse, ref missing, ref missing, ref missing, ref missing);
}
使用编辑器