Hi, I’m trying to print an excel file with an image but the image is missing in the printed output.
Attache file template.xls is the file i am trying to print.
Below is the code:
String fileNameString = “/C:/apache-tomcat-7.0.0/webapps/MyApp/doc/template/template.xls”;
PrintService ps = getDefaultPrintService();
Workbook workbook = new Workbook();
workbook.open(fileNameString, FileFormatType.DEFAULT);
Worksheet worksheet;
for (int i = 0; i < workbook.getWorksheets().getCount(); i++)
{
worksheet = workbook.getWorksheets().get(i);
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions ();
imgOptions.setOnePagePerSheet(true);
SheetRender sr = new SheetRender(worksheet, imgOptions);
//Print the worksheet
sr.toPrinter(ps.getName());
}