Excelワークシートの透過画像を作成

Contents
[ ]

次のワークシート イメージでは、透明度が適用されていません。塗りつぶしの色がないセルは白で描画されます。

透明度なしの出力: セルの背景は白です
todo:画像_代替_文章

一方、次のワークシート イメージでは、透明度が適用されています。塗りつぶしの色がないセルは透明です。

透明度を有効にして出力
todo:画像_代替_文章

次のサンプル コードは、Excel ワークシートから透明なイメージを生成します。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Create workbook object from source file
Workbook wb = new Workbook(sourceDir + "sampleCreateTransparentImage.xlsx");
// Apply different image or print options
var imgOption = new ImageOrPrintOptions();
imgOption.ImageType = Drawing.ImageType.Png;
imgOption.HorizontalResolution = 200;
imgOption.VerticalResolution = 200;
imgOption.OnePagePerSheet = true;
// Apply transparency to the output image
imgOption.Transparent = true;
// Create image after apply image or print options
var sr = new SheetRender(wb.Worksheets[0], imgOption);
sr.ToImage(0, outputDir + "outputCreateTransparentImage.png");