Imprimer les commentaires lors de l enregistrement au format PDF
Microsoft Excel permet d’imprimer les commentaires lors de l’impression ou de l’enregistrement au format PDF avec les options suivantes
- Aucun
- À la fin de la feuille
- Tel qu’affiché sur la feuille
Aspose.Cells for Python via .NET fournit l’énumération PrintCommentsType pour prendre en charge cette fonctionnalité. L’énumération PrintCommentsType contient les membres suivants
- PrintNoComments
- PrintInPlace
- PrintSheetEnd
Imprimer les commentaires lors de l’enregistrement au format PDF
Le code d’exemple suivant illustre comment utiliser PrintCommentsType pour imprimer les commentaires lors de l’enregistrement au format PDF.
| from aspose.cells import PrintCommentsType, Workbook | |
| # The path to the documents directory. | |
| dataDir = "./" | |
| # 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") |