English 中文(简体)
用C#
原标题:InsertSymbol in Word using C#
  • 时间:2010-12-01 15:03:54
  •  标签:
  • c#
  • ms-word

I m creating a custom Microsoft Word mailmerge console application using C#. My only problem is trying to use the InsertSymbol command (from Microsoft.Office.Interop.Word). The purpose is to drop in a checked box symbol if the field value is true, and an empty box if the field value is false.

微软对这一指令的定义如下:here,没有具体实例。

我指挥的方法是:

Object oFont = "Wingdings";

Object oUnicode = "true";

Object oBias = Word.WdFontBias.wdFontBiasDontCare;

oWord.Selection.InsertSymbol(254, ref oFont, ref oUnicode,ref oBias);

当我试图管理这一指挥时,我发现错误“这不是一个有效的编号”。 这一指挥没有很多实例,我希望提出一些想法。 感谢。

最佳回答

我找到答案。 我的问题围绕的是带有引号的 o法的价值。 我删除了引言,现在它完全发挥作用。 我只想让人们知道,它现在工作。

问题回答

谢谢。 Robert for Common this Solutions:

Object oFont = "Wingdings";
Object oUnicode = true;
Object oBias = Word.WdFontBias.wdFontBiasDontCare;
oWord.Selection.InsertSymbol(254, ref oFont, ref oUnicode,ref oBias);

它行之有效!

我拿不出你的法典。 但随后,我对我的印象是,世界志愿人员组织对虚假和真实的看法不同: 确实是第1号(第1号),因此,你应当确定:

oUnicode = 1;//NOT "true" and that IS 1 truth

Doing that I got the code working correctly. That also communicates with the error description ( not a valid number )





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签