Node.jsを経由したC++でExcelワークシートの透過画像を作成する

Contents
[ ]

以下のワークシートイメージでは、透明性が適用されていません。埋められていないセルは白色で描画されます。

透明度なしの出力: セルの背景は白です
todo:image_alt_text

以下のワークシート画像では、透明度が適用されました。塗りつぶしのないセルは透明です。

透明度を有効にした出力
todo:image_alt_text

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

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// Source directory
const sourceDir = path.join(__dirname, "data");

// Output directory
const outputDir = path.join(__dirname, "output");

// Create workbook object from source file
const wb = new AsposeCells.Workbook(path.join(sourceDir, "sampleCreateTransparentImage.xlsx"));

// Apply different image or print options
const imgOption = new AsposeCells.ImageOrPrintOptions();
imgOption.setImageType(AsposeCells.ImageType.Png);
imgOption.setHorizontalResolution(200);
imgOption.setVerticalResolution(200);
imgOption.setOnePagePerSheet(true);

// Apply transparency to the output image
imgOption.setTransparent(true);

// Create image after applying image or print options
const sr = new AsposeCells.SheetRender(wb.getWorksheets().get(0), imgOption);
sr.toImage(0, path.join(outputDir, "outputCreateTransparentImage.png"));