Specify job name when printing with Aspose.Cells

How can I specify the job name when I print workbooks? I’m using this sample, but cannot find an option to set the name.

Aspose.Cells uses “Java Printing” as the job name.

Regards
Paul

Hi Paul,


Thank you for considering Aspose APIs.

We have logged a Feature Request in our database against your requirement of specifying Document Name/Job Name while printing spreadsheets with Aspose.Cells for Java API. The ticket Id for your future reference is CELLSJAVA-41143. Please spare us little time to analyze the feasibility of your requested feature, and provide the implementation with future releases of Aspose.Cells APIs. In the meanwhile, we will keep you posted with updates in this regard.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed this issue.

Please download and try this fix: Aspose.Cells for Java v8.3.1.2 and let us know your feedback.

We have added the API: toPrinter(String
PrinterName, String JobName)
in the WorkbookRender and
SheetRender.

Hi,

thank you for the update. Unfortunately, this fix does not work for me. The following exception thrown:

Exception in thread “main” com.aspose.cells.CellsException: WorkbookRender only support Tiff
at com.aspose.cells.WorkbookRender.(Unknown Source)

I am trying to print a XLSX file. With version 8.3.0, the document is printed with the default “Java Printing” job name.

Regards
Paul

Hi Paul,


Thank you for writing back.

Please note, the latest version of Aspose.Cells for Java API is 8.3.1.2 as mentioned in our previous response. Moreover, the feature to specify the printing job name has been implemented in the aforesaid release and is not present in v8.3.0. We would request you to please try your case with the latest revision of Aspose.Cells for Java API. In case the problem persists, please provide us your source code as well as sample template spreadsheet to investigate the said exception on our side.

Hi,

this seems to be a misunderstanding. I will try to clarify this:

With version 8.3.1.2 attached to Shakeel Faiz’s post and using the new toPrinter(String PrinterName, String JobName) method, I get the exception posted above: WorkbookRender only support Tiff.

With version 8.3.0 that I used before, the document can be printed but the JobName parameter is of course not available.

You may use my document for testing, but I’m sure that any XLSX will reproduce the exception.

This is the code used:
Workbook workbook = new Workbook(new FileInputStream(“Counter.xlsx”));
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
WorkbookRender workbookRender = new WorkbookRender(workbook, imgOptions); // this will fail with 8.3.1.2
workbookRender.toPrinter(“Printer name”);

Regards
Paul

Hi Paul,


Thank you for providing more details.

You are right, the presented problem is not template specific however you are missing one important setting in your code, that is; ImageFormat for the ImageOrPrintOptions class. Please check the following piece of code and give it a try at your end.

Java

Workbook excelDocument = new Workbook(“D:/temp/2.xlsx”);
com.aspose.cells.ImageOrPrintOptions imageOrPrintOptions = new com.aspose.cells.ImageOrPrintOptions();
imageOrPrintOptions.setImageFormat(com.aspose.cells.ImageFormat.getTiff());
com.aspose.cells.WorkbookRender render = new com.aspose.cells.WorkbookRender(excelDocument, imageOrPrintOptions);
try {
render.toPrinter(“HP LaserJet Professional P1102”, “test job”);
} catch (Exception exception) {
System.out.println(exception);
}

Hi,

yes, when I set this option it works as expected. Perfect, thank you!

Do you know when this feature will be included in the main branch?

Regards
Paul

Hi Paul,


It is good to know that you are up & running again. The said feature will be included in the next major release of Aspose.Cells for Java 8.3.2 that is scheduled for the 3rd quarter of January 2015. As soon as the said release is available for public use, you will be automatically notified here.

The issues you have found earlier (filed as CELLSJAVA-41143) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.