DsExcel supports controlling the transparency of an image by providing setTransparency method in IPictureFormat interface. The value of transparency can vary between 0.0 (opaque) to 1.0 (clear).
Refer to the following example code to set the transparency of an image.
Java |
Copy Code |
---|---|
// Create a new workbook Workbook workbook = new Workbook(); // Use sheet index to get worksheet. IWorksheet worksheet = workbook.getWorksheets().get(0); // Add a picture IShape picture = worksheet.getShapes().addPicture("Image.png", 20, 20, 490, 120); // Set picture's transparency as 60%. picture.getPictureFormat().setTransparency(0.6); // Save to an excel file workbook.save("ImageTransparency.xlsx"); |