cancel
Showing results for 
Search instead for 
Did you mean: 

Flush?

Former Member
0 Kudos

Hi All,

I implemented the "Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)" blog.

An exception: "you must flush before accessing the resource content" occurs.

Any ideas on how to overcome this problem?

Regards,

Motaz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Motaz Abu Karat ,

Whe u create IWDResource using WDResourceFactory give the true for boolean arguement.

IWDResource resource =

WDResourceFactory.createResource(InputStream,String,WDWebresoucetype,true)),

Regards,

srikanth

Answers (3)

Answers (3)

Former Member
0 Kudos

Haven't found a solution.

Thread closed.

Former Member
0 Kudos

Hi Motaz,

The above code is deprecated :-

Replace that with this piece of code -->

File f = new File(fileName);
WritableWorkbook workbook = Workbook.createWorkbook(f);
..................
..................
..................
FileInputStream excelCSVFile = new FileInputStream(f);
*IWDResource cachedExcelResource = WDResourceFactory.createCachedResource(excelCSVFile, "FileName.xls", WDWebResourceType.XLS, false);*
wdContext.currentContextElement().setResource(cachedExcelResource);

cachedExcelResource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal());

WDFileDownloadBehaviour --> Will determine how you would like to download your file.

Hope this helps !!!

Cheers,

Brian.

Former Member
0 Kudos

Hi Srikanth,

How about if I am using file?

Regards,

Motaz

Former Member
0 Kudos

Hi Srikanth,

The problem is in the blog this: "cachedWebResource = WDWebResource.getWebResource(file, type);" is used.

Any idea how to apply flush in this case?

Regards,

Motaz

Former Member
0 Kudos

Hi Motaz Abu Karat, ,

If u r using ByteArrayOutputStream,

ByteArrayOutputStream baos=new ByteArrayOutputStream();

after writing the content use baos.flush();

Regards,

srikanth