MiscrosoftWordLabelPrintingUtilityProblem目前我正在使用MicrosoftWordLabelPrintingUtility从我的.NET应用程序打印标签。我正在使用以下代码打印标签。Word.ApplicationoWord;Word._DocumentoDoc;oDoc=oWord.Documents.Add();vara=oWord.MailingLabel.CreateNewDocument("每页30","",Type.Missing,false,Type.Missing,Type.Missing,Type.Missing);oWord.Visible=false;vartable=a.Content.ConvertToTable().Tables[1];varinnertable=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;内表e.Columns[1].Cells[2].Range.Font.Name="SegoeUI";vardocs=oWord.Documents;oWord.Visible=true;现在的问题是这里创建了两个文档,但我只想打开一个包含标签的文档。非常感谢你提前......!请删除以下行:Word._DocumentoDoc;oDoc=oWord.Documents.Add();因为他们在Word应用程序中创建新的标准文档。您不会在代码中的任何地方使用它,因此看起来您不需要它。编辑我不认为在不打开任何其他文档的情况下添加MailingLabel文档是可能的。所以另一个建议是在创建MailingLabel后关闭oDoc文档。请试试这个://在这一行之后oWord.Visible=false;//尝试添加oDoc.Close();我已经用这一行手动关闭了我的标准文档:oDoc.Close();谢谢...!!以上就是C#学习教程:MiscrosoftWord标签打印实用程序问题分享的全部内容。如果对你有用,需要进一步了解C#学习教程,希望大家多多关注。本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
