Node.jsを使用してC++経由でワークシート内のシェイプの絶対位置を見つける方法
Contents
[
Hide
]
時には、ワークシート内のシェイプの絶対位置を知る必要があります。Aspose.Cells for Node.js via C++は、この目的のためにShape.getLeftToCorner()およびShape.getTopToCorner()プロパティを提供します。これらのプロパティは、ワークシート内でのシェイプの絶対位置をピクセル単位で返します。
次のサンプルコードは、ワークシート内の最初の形状の絶対位置をピクセル単位で表示します。サンプルコードは、次のコンソール出力を表示します:
Absolute Position of this Shape is (320 , 183)
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Load the sample Excel file inside the workbook object
const workbook = new AsposeCells.Workbook(path.join(dataDir, "sample.xlsx"));
// Access the first worksheet
const worksheet = workbook.getWorksheets().get(0);
// Access the first shape inside the worksheet
const shape = worksheet.getShapes().get(0);
// Displays the absolute position of the shape
console.log(`Absolute Position of this Shape is (${shape.getLeftToCorner()} , ${shape.getTopToCorner()})`);