NamedRange.CopyPicture Method (XlPictureAppearance, XlCopyPictureFormat)

 

Copies the NamedRange control to the Clipboard as a picture.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

object CopyPicture(
	XlPictureAppearance Appearance = XlPictureAppearance.xlScreen,
	XlCopyPictureFormat Format = XlCopyPictureFormat.xlPicture
)

Parameters

Appearance
Type: Microsoft.Office.Interop.Excel.XlPictureAppearance

Specifies how the picture should be copied.

Can be one of the following XlPictureAppearance constants:

xlPrinter

xlScreen

Format
Type: Microsoft.Office.Interop.Excel.XlCopyPictureFormat

The format of the picture.

Can be one of the following XlCopyPictureFormat constants:

xlBitmap

xlPicture

Return Value

Type: System.Object

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example creates a NamedRange and populates it with the word Smith. It then uses the CopyPicture method to copy the NamedRange to the Clipboard as a bitmap.

This example is for a document-level customization.

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);
}
Return to top
Show: