Hi All,
Have one question on cognos SDK. I need to read the report contents and save as a html file OR need to import the report as a pdf file / htm file.
How to achieve this ? please share your ideas. and i am able to connect to the content store and able to list the reports
You can access the report specification content XML through the use of CMService Query method. This might help you out.
ex:
public void setReportSpecs(String ReportPath) throws Exception{
String sReportSpec = null;
PropEnum props[] = new PropEnum[]{PropEnum.searchPath, PropEnum.defaultName, PropEnum.specification};
SearchPathMultipleObject spMulti = new SearchPathMultipleObject();
spMulti.set_value(ReportPath);
try {
BaseClass[] repPth = cognosConnection.getCmService().query(spMulti, props, new Sort[]{}, new QueryOptions());
// There should be only one report with the specified searchPath
if (repPth != null && repPth.length > 0)
{
// extract the report spec
sReportSpec = (((Report) repPth[0]).getSpecification().getValue());
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
InputStream is = new ByteArrayInputStream(sReportSpec.getBytes("UTF-8"));
this.xmlDoc = builder.parse(is);
}
else
this.xmlDoc = null;
} catch (Exception e) {
e.printStackTrace();
}
}