The report was generated in Excel file and stored in a
shared drive location from where it was uploaded into the KM repository
using KM API in Portal application.
//Create Excel Report in the Shared Drive// trgtlocation is the location of the Excel report in the Shared driveString trgtLocation ="C:\\Report\\Excel.xls";File f = new File(trgtLocation);//*******************************************//// code to generate excel workbook and sheets excluded//*******************************************//try{f.createNewFile();workbook = Workbook.createWorkbook(f);sheet = workbook.createSheet("First Sheet", 0);}catch(Exception e){}File myExcel = new File("C:\\ Report\\Excel.xls");InputStream myIS=new FileInputStream(myExcel);IContent aContent = new Content(myIS,"byte",-1);if(aCollection != null){IResource aResource=( IResource)aCollection.createResource(Excel.xls,null,aContent);myIS.close();}//End of outer if}catch(AccessDeniedException ex){}catch(NotSupportedException ex){}catch(ResourceException ex){}
No comments:
Post a Comment