Spécifier le nom de l emploi ou du document lors de l impression avec Aspose.Cells

Spécifier le nom du travail ou du document lors de l’impression avec Aspose.Cells

Le code d’exemple charge le fichier Excel source, puis l’envoie à l’imprimante en spécifiant le nom de la tâche ou du document à l’aide des méthodes WorkbookRender.toPrinter(printerName, jobName) et SheetRender.toPrinter(printerName, jobName). La capture d’écran montre à quoi ressemble le nom de la tâche dans la file d’attente de l’imprimante.

todo:image_alt_text

// 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);

Articles Connexes