Printing Excel File programmatically
807603Nov 15 2007 — edited Nov 15 2007Hi,
Can any body help me in printing an excel file with java
I tried executing the below code.
DocFlavor format = new DocFlavor("application/octet-stream", "java.io.FileInputStream");
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
aset.add(new Copies(1));
PrintService pservices = rintServiceLookup.lookupDefaultPrintService();
DocPrintJob djob = pservices.createPrintJob();
FileInputStream input = new FileInputStream("Test.xls");
Doc doc = new SimpleDoc(input, format, null);
djob.print(doc, aset);
it prints the file if it a plain text file,if i try to print Excel File it is printing some weird characters.
Can anybody help me in this ASAP?
-- Sowmya