Aspose.Cells で印刷時にジョブまたはドキュメント名を指定する
Contents
[
Hide
]
Aspose.Cellsを使用してワークブックまたはワークシートを印刷する際に、WorkbookRenderまたはSheetRenderオブジェクトを使用してジョブまたは文書名を指定することができます。Aspose.Cellsは、ワークブックまたはワークシートを印刷する際に使用できるWorkbookRender.toPrinter(printerName, jobName)およびSheetRender.toPrinter(printerName, jobName)メソッドを提供しています。
Aspose.Cellsを使用して印刷時にジョブまたは文書名を指定する
サンプルコードは、ソースExcelファイルを読み込み、WorkbookRender.toPrinter(printerName, jobName)およびSheetRender.toPrinter(printerName, jobName)メソッドを使用して印刷時にジョブまたは文書名を指定し、プリンターキュー内でのジョブ名の表示を示しています。
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(SpecifyJoborDocumentName.class); | |
// Create workbook object from source Excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Specify Printer and Job Name | |
String printerName = "doPDF v7"; | |
String jobName = "Job Name while Printing with Aspose.Cells"; | |
// Print workbook using WorkbookRender | |
WorkbookRender wr = new WorkbookRender(workbook, new ImageOrPrintOptions()); | |
wr.toPrinter(printerName, jobName); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Print worksheet using SheetRender | |
SheetRender sr = new SheetRender(worksheet, new ImageOrPrintOptions()); | |
sr.toPrinter(printerName, jobName); | |