CognosHelp
Programmer
Hi ,
I am using ReportnetAPI to login into Cognos sever and get the PDF or XLS file . These files will be regenrayed based on input i give.I am getting PDF file without any error. BUt i am not getting XLS in proper format. I have given the short code here. Please could someone help me on this;
/////code to populate params
ReportServiceResponse rsr = null;
try {
rsr = oCrn.execute(reportPath,params,ro);
} catch (RemoteException e) {
}
try {
rsr = oCrn.getOutput(rsr.getPrimaryRequest());
} catch (RemoteException e) {
}
}
byte [] binaryOutput = Base64.decode(rsr.getOutputPages()[0]);
File tempFile = null;
try {
if ((xPath.equals("xxx_xls")) || (xPath.equals("yyy_xls"))){
tempFile = File.createTempFile("rep",".xls",new File(destDir));
}else{
tempFile = File.createTempFile("rep",".pdf",new File(destDir));
}
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(binaryOutput);
fos.close();
I am using ReportnetAPI to login into Cognos sever and get the PDF or XLS file . These files will be regenrayed based on input i give.I am getting PDF file without any error. BUt i am not getting XLS in proper format. I have given the short code here. Please could someone help me on this;
/////code to populate params
ReportServiceResponse rsr = null;
try {
rsr = oCrn.execute(reportPath,params,ro);
} catch (RemoteException e) {
}
try {
rsr = oCrn.getOutput(rsr.getPrimaryRequest());
} catch (RemoteException e) {
}
}
byte [] binaryOutput = Base64.decode(rsr.getOutputPages()[0]);
File tempFile = null;
try {
if ((xPath.equals("xxx_xls")) || (xPath.equals("yyy_xls"))){
tempFile = File.createTempFile("rep",".xls",new File(destDir));
}else{
tempFile = File.createTempFile("rep",".pdf",new File(destDir));
}
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(binaryOutput);
fos.close();