PDFへ保存する際にコメントを印刷する
Contents
[
Hide
]
Microsoft Excelでは、印刷またはPDF形式への保存時にコメントを印刷する機能が以下のオプションで提供されています
- なし
- シートの末尾
- シートに表示されている通り
Aspose.Cells for Python via .NETは、同じ機能をサポートするためにPrintCommentsType列挙型を提供します。PrintCommentsType列挙型には、次のメンバーが含まれています。
- PrintNoComments
- PrintInPlace
- PrintSheetEnd
PDFへ保存する際にコメントを印刷する
以下のサンプルコードは、PrintCommentsTypeを使用してPDFに保存する際にコメントを印刷する方法を示しています。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import PrintCommentsType, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Create a workbook from source Excel file | |
workbook = Workbook(dataDir + "SampleWorkbookWithComments.xlsx") | |
# Access first worksheet | |
worksheet = workbook.worksheets[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.page_setup.print_comments = PrintCommentsType.PRINT_SHEET_END | |
# Save workbook in pdf format | |
workbook.save(dataDir + "PrintCommentWhileSavingToPdf_out.pdf") |