on 07-22-2008 5:21 AM
Hi all,
I had a excel template saved in Mimes and wanted to download on click of Link to action etc...
Tried many codes related to cachedwebresource but not able to resolve it
Everytime on running the application, result view comes wid contact administrator.No error on it...
Kindly help.
Thanks n best regards
Mandeep Kaur
use this code to open attachment from mimes
try{
/** get file as binary */
File file = new File(
WDURLGenerator.getResourcePath(
wdComponentAPI.getDeployableObjectPart(),
"Excel_FileName"));
FileInputStream instream = new FileInputStream(file);
long filelen = file.length();
byte[] binary = new byte[(int)filelen];
int offset = 0;
int numread = 0;
while(offset<binary.length &&
(numread = instream.read(binary,
offset,
binary.length-offset))>=0){
offset +=numread;
}
instream.close();
/** create Resource out of binary read */
if(binary!=null){
cachedresource = WDWebResource.getWebResource(binary, WDWebResourceType.XLS);
url = cachedresource.getURL();
}
/** create window to open document */
IWDWindow docwin = wdComponentAPI
.getWindowManager()
.createNonModalExternalWindow(url, "EcxelFileName");
docwin.show();
}catch(Exception e){
msgBox("error reading file");
}
let me know the status
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.