Document Solutions for Excel, .NET Edition | Document Solutions
Features / Shapes and Pictures / Image Transparency
In This Topic
    Image Transparency
    In This Topic

    DsExcel supports controlling the transparency of an image by providing Transparency property in IPictureFormat interface. The value of Transparency can vary between 0.0 (opaque) to 1.0 (clear).

    Using Code

    Refer to the following example code to set the transparency of an image.

    C#
    Copy Code
    //create a new workbook
    var workbook = new GrapeCity.Documents.Excel.Workbook();
    
    //use sheet index to get worksheet
    IWorksheet worksheet = workbook.Worksheets[0];
    
    //add an image
    var picture = worksheet.Shapes.AddPicture("Image.png", 10, 10, 200, 100);
    
    //set image transparency as 60%
    picture.PictureFormat.Transparency = 0.6;
    
    //save to an excel file
    workbook.Save("imagetransparent.xlsx");