找了一个这样的做法,可是每次打印机队列里看不出来我打的是哪个,比如我打了100个小说,可是每个名字都叫microsoft word,有没有什么办法能够从打印机队列里看出来我打的文档是哪个?
因为是用模板,所以每个名字都一样,可不可以发给打印机的时候改名字?求高手,求代码!! Word._Application wrdApp = null;
            Word._Document wrdDoc = null;
            Word.MailMerge wrdMailMerge;            object oMissing = System.Reflection.Missing.Value;
            object oFalse = false;
            object oTrue = true;
            object oNull = String.Empty;            try
            {
                wrdApp = new Word.Application();
                wrdApp.Visible = false;
                wrdApp.ChangeFileOpenDirectory(Directory.GetCurrentDirectory());
                object oEnvelopeTemplate = envelope_template;
                wrdDoc = wrdApp.Documents.Add(ref oEnvelopeTemplate, ref oMissing,
                    ref oMissing, ref oMissing);
                wrdMailMerge = wrdDoc.MailMerge;                wrdMailMerge.OpenDataSource(
                    "《李白古诗集1》",
                    ref oMissing, ref oMissing, ref oFalse, ref oTrue, ref oFalse,
                    ref oMissing, ref oMissing, ref oFalse, ref oMissing, ref oMissing,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                wrdApp.ActivePrinter = envelope_printer;
                wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
                wrdMailMerge.SuppressBlankLines = true;
                wrdMailMerge.Execute(ref oFalse);
                wrdApp.ActivePrinter = "打印机";
                return true;
            }

解决方案 »

  1.   

    http://topic.csdn.net/u/20100313/12/b7e2ceb5-08ab-4fa8-92b5-12b4cbde061f.html?70298
      

  2.   

    怎么修改word发送给打印机的doc的名字
      

  3.   

    这里面的关于Name的属性都是只读的,不能设置。你可以
    wrdDoc.SaveAs("你要保存的文档路径", ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);这样可以设置名字,但是你要保存
      

  4.   

    关于office的问题,如果你要在程序里边生成word  我劝你不要用office自带的组件,一是因为效率低,二是因为常出错,我现在是用第三方组件 名字叫  Aspose  很好用速度很快  网上有Demo 
    http://www.51jidianhuan.com   
    http://www.hbtiantai.cn