NamedRange.CopyPicture(XlPictureAppearance, XlCopyPictureFormat) 方法

定义

NamedRange 控件作为图片复制到剪贴板。

public object CopyPicture (Microsoft.Office.Interop.Excel.XlPictureAppearance Appearance = Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Microsoft.Office.Interop.Excel.XlCopyPictureFormat Format = Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlPicture);
abstract member CopyPicture : Microsoft.Office.Interop.Excel.XlPictureAppearance * Microsoft.Office.Interop.Excel.XlCopyPictureFormat -> obj
Public Function CopyPicture (Optional Appearance As XlPictureAppearance = Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Optional Format As XlCopyPictureFormat = Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlPicture) As Object

参数

Appearance
XlPictureAppearance

指定应如何复制图片。可以是以下 XlPictureAppearance 常量之一: xlPrinterxlScreen

Format
XlCopyPictureFormat

图片的格式。可以是以下 XlCopyPictureFormat 常量之一: xlBitmapxlPicture

返回

示例

下面的代码示例创建 并使用 NamedRange 单词 Smith 填充它。 然后, CopyPicture 它使用 方法将 作为位图复制到 NamedRange 剪贴板。

此示例适用于文档级自定义项。

Microsoft.Office.Tools.Excel.NamedRange copyBitmapRange;
private void CopyAsBitmap()
{
    copyBitmapRange = this.Controls.AddNamedRange(
        this.Range["C3"], "copyBitmapRange");
    this.copyBitmapRange.Value2 = "Smith";
    this.copyBitmapRange.CopyPicture(
        Excel.XlPictureAppearance.xlScreen,
        Excel.XlCopyPictureFormat.xlBitmap);
}
Private copyBitmapRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub CopyAsBitmap()
    copyBitmapRange = Me.Controls.AddNamedRange( _
        Me.Range("C3"), "copyBitmapRange")
    Me.copyBitmapRange.Value2 = "Smith"
    Me.copyBitmapRange.CopyPicture( _
        Excel.XlPictureAppearance.xlScreen, _
        Excel.XlCopyPictureFormat.xlBitmap)
End Sub

注解

可选参数

有关可选参数的信息,请参阅 Office 解决方案中的可选参数

适用于