English 中文(简体)
C#
原标题:Inlineshape select method in C#
  • 时间:2011-10-28 09:16:47
  •  标签:
  • c#

我一直在C#中尝试用以下代码提取图像,但一米则照搬如下:

Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();

            Microsoft.Office.Interop.Word.Document oDoc = new Microsoft.Office.Interop.Word.Document();

 oDoc = oWord.Documents.Open(ref str1......);

oDoc.InlineShapes.Select();

错误:

oDoc.InlineShapes.Select();
The requested member of the collection does not exist.

让我知道,这一行文有什么错误?

问题回答

只要我能说明<条码>InlineShapes的收集,就没有光线<条码>(<>Select(<>/code>)方法。 因此,我假定,你正在设法在收集工作中使用支线。

http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.inlineshapes%28v=office.11%29.aspx”rel=“nofollow”>InlineShapes。 如果没有<代码>Select(......)方法。

我怀疑你需要这样做,

// Note the select is spurious here
oDoc.InlineShapes.OfType<InlineShape>().Select((shape) => shape)

IEvidable<T>,其中支持< 编码>Select(......)方法。

认为如果将<条码>数字延伸至<条码>,则在<条码>上将无任何有用特性。 目标

www.un.org/Depts/DGACM/index_french.htm

如果你想从InlineShapes那里获得图像,你可以......

 var pictures = oDoc.InlineShapes.OfType<InlineShape>().Where(s =>
    s.Type = WdInlineShapeType.wdInlineShapePicture ||
    s.Type = WdInlineShapeType.wdInlineShapeLinkedPicture ||
    s.Type = WdInlineShapeType.wdInlineShapePictureHorizontalLine ||
    s.Type = WdInlineShapeType.wdInlineShapeLinkedPictureHorizontalLine);

 foreach(var picture in pictures)
 {
     picture.Select();
     oWord.Selection.Copy()

     //Then you need to retrieve the contents of the clipboard
     //which I feel is another question.
 }

这应当使你了解文件所载的一整套内容。





相关问题
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. ...

热门标签