تحديد مهمة أو اسم الوثيقة أثناء الطباعة باستخدام Aspose.Cells
Contents
[
Hide
]
يمكنك تحديد اسم الوظيفة أو المستند أثناء طباعة مصنفك أو ورقة العمل باستخدام الكائنات 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); | |