Node.js経由のC++を使ってPDFに保存する際にコメントを印刷します
Contents
[
Hide
]
Microsoft Excelでは、印刷またはPDF形式への保存時にコメントを印刷する機能が以下のオプションで提供されています
- なし
- シートの末尾
- シートに表示されている通り
Aspose.Cellsは、同じ機能をサポートするPrintCommentsType列挙型を提供します。PrintCommentsType列挙型には以下のメンバーがあります
- PrintNoComments
- PrintInPlace
- PrintSheetEnd
PDFへ保存する際にコメントを印刷する
次のサンプルコードは、コメントを印刷してPDFに保存する方法を示しています。
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create a workbook from the source Excel file
const workbook = new AsposeCells.Workbook(path.join(dataDir, "SampleWorkbookWithComments.xlsx"));
// Access the first worksheet
const worksheet = workbook.getWorksheets().get(0);
/*
* For print no comments use "PrintCommentsType.PrintNoComments"
* and for print the comments as displayed on sheet use "PrintCommentsType.PrintInPlace"
* For Print the comments at the end of sheet we use "PrintCommentsType.PrintSheetEnd"
*/
worksheet.getPageSetup().setPrintComments(AsposeCells.PrintCommentsType.PrintSheetEnd);
// Save workbook in pdf format
workbook.save(path.join(dataDir, "PrintCommentWhileSavingToPdf_out.pdf"));