保存为PDF时打印注释
Contents
[
Hide
]
Microsoft Excel允许您在打印或保存为PDF格式时打印注释,具有以下选项
- 无
- 工作表末尾
- 如在工作表上显示的那样
Aspose.Cells for Python via .NET提供PrintCommentsType枚举以支持相同的功能。PrintCommentsType枚举具有以下成员
- PrintNoComments
- PrintInPlace
- PrintSheetEnd
保存为PDF时打印注释
以下示例代码说明了如何使用PrintCommentsType来在保存为PDF时打印注释。
This file contains 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") |