Miscrosoft Word标签打印实用程序问题 [英] Miscrosoft Word Label Printing Utility issue

查看:81
本文介绍了Miscrosoft Word标签打印实用程序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用Microsoft Word标签打印实用程序从.NET应用程序中打印标签.我正在使用以下代码来打印标签.

Currently I am using Microsoft Word Label Printing Utility to print Labels from my .NET application. I am using following code to print labels.

            Word.Application oWord;
            Word._Document oDoc;

            oDoc = oWord.Documents.Add();
            var a = oWord.MailingLabel.CreateNewDocument("30 Per Page", "", Type.Missing, false, Type.Missing, Type.Missing, Type.Missing);
            oWord.Visible = false;
            var table = a.Content.ConvertToTable().Tables[1];
            var innertable = table.Columns[1].Cells[1].Range.ConvertToTable();
            innertable.Columns[1].Cells[1].Range.Bold = 1;

            innertable.Columns[1].Cells[1].Range.Text = "sdadad";
            innertable.Columns[1].Cells[1].Range.Font.Bold = 1;
            innertable.Columns[1].Cells[1].Range.Font.Color = Word.WdColor.wdColorBlue;
            innertable.Columns[1].Cells[1].Range.Font.Size = 15F;
            innertable.Columns[1].Cells[1].Range.Font.Name = "Verdana";
            innertable.Rows.Add();
            innertable.Columns[1].Cells[2].Range.Text = "fsdfsdfsdf";
            innertable.Columns[1].Cells[2].Range.Font.Bold = 0;
            innertable.Columns[1].Cells[2].Range.Font.Color = Word.WdColor.wdColorBrown;
            innertable.Columns[1].Cells[2].Range.Font.Size = 12F;
            innertable.Columns[1].Cells[2].Range.Font.Name = "Segoe UI";

            var docs=oWord.Documents;
            oWord.Visible = true;

现在的问题是,这里创建了两个文档.但是我只希望打开带有标签的文档.

Now the problem is that here two documents are created. But I want only document with labels to be open.

非常感谢您!!!

推荐答案

我已使用以下行手动关闭了标准文档:

I have closed my standard document manually using following line:

oDoc.Close();

谢谢... !!

这篇关于Miscrosoft Word标签打印实用程序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆