我從一個Word文檔複製編程的圖像到剪貼板。如何從圖像粘貼剪貼板到Word
我想該圖像粘貼到使用C#和爲的Microsoft.Office.Interop.Word參考字一個字的文件。
下面是代碼:
foreach (Words.InlineShape shape in document.InlineShapes)
{
if (shape != null)
{
if (shape.Type == Words.WdInlineShapeType.wdInlineShapePicture)
{
shape.Select();
app.Selection.CopyAsPicture();
Words.Document doc = app.Documents.Add();
System.Drawing.Image img = null;
if (Clipboard.ContainsImage())
{
img = Clipboard.GetImage();
IDataObject idata = Clipboard.GetDataObject();
}
}
}
}
產生一些你的代碼你如何嘗試這樣做 –