保存为PDF时打印注释
Contents
[
Hide
]
Microsoft Excel允许您在打印或保存为PDF格式时打印注释,具有以下选项
- 无
- 在工作表的末尾
- 如在工作表上显示的那样
保存为PDF时打印注释
Aspose.Cells提供以下枚举来支持在保存PDF时打印注释
- PrintCommentsType.PRINT_NO_COMMENTS
- PrintCommentsType.PRINT_IN_PLACE
- PrintCommentsType.PRINT_SHEET_END
代码片段
以下示例代码说明了如何使用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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(PrintComments.class); | |
// Create a workbook from source Excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Print no comments | |
worksheet.getPageSetup().setPrintComments(PrintCommentsType.PRINT_NO_COMMENTS); | |
// Print the comments as displayed on sheet | |
worksheet.getPageSetup().setPrintComments(PrintCommentsType.PRINT_IN_PLACE); | |
// Print the comments at the end of sheet | |
worksheet.getPageSetup().setPrintComments(PrintCommentsType.PRINT_SHEET_END); | |
// Save workbook in pdf format | |
workbook.save(dataDir + "out.pdf"); |