on 02-26-2008 7:55 AM
Hi gurus,
I am having requirement for opening an new word document dynamically using a button.
It's urgent.
For correct answer reward points will be given.
Regards,
AK
Check this code it will work
try
{
File f=new File("NewDocument1.doc");
FileOutputStream fos=new FileOutputStream(f);
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
byte[] data = new byte[(int)(fc.size())];
IWDCachedWebResource cachedWebResource=WDWebResource.getWebResource(data,WDWebResourceType.DOC);
cachedWebResource.setResourceName("NewDocument1.doc");
String url=cachedWebResource.getURL();
IWDWindow window=wdComponentAPI.getWindowManager().createExternalWindow(url,"cmps",true);
window.open();
}
catch(Exception ioe)
{
wdComponentAPI.getMessageManager().reportSuccess(ioe.getMessage());
wdComponentAPI.getMessageManager().reportException("Exception in Method cmps :::"+ioe.getMessage(),false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a filedownload UI Element.In the context create a varialble "fileResource" of type com.sap.ide.webdynpro.uielementdefinitions.Resource.Bind the resource property of the filedownload element to created "fileResource" context variable.
In the doModifyView(),paste the following code
StringBuffer file = new StringBuffer();
byte[] data = file.toString().getBytes("UTF-8");
IWDResource resource = WDResourceFactory.createResource(data, "FileName",
WDWebResourceType.DOC);
wdContext.currentContextElement().setFileResource(resource);
Regards,
Sudhir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi sudhir,
My requirement is to open a word document by clicking "submit" button.
We should not use office control,filedownload UIelements.
Actually what i have to do is,
i have to open an empty word document in new window on clicking a button.
Regards,
AK.
Edited by: akshay k on Feb 26, 2008 12:35 PM
Hi,
The best you can do is open the word document inside the browser. Follow these steps:
1. Create a new blank word document and call it for example "template.doc".
2. Switch to the Navigator view of the IDE & navigate to <your project name>/src/mimes/Components/<your component name> folder.
3. Paste the "template.doc" file inside this folder.
4. Now you can load this document in a new window by writing the following code in the eventhandler for the onAction event of the button:
try {
String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), "template.doc");
wdComponentAPI.getWindowManager().createNonModalExternalWindow(url, "Word").show();
} catch (WDURLException e) {
e.printStackTrace();
}
5. This will open word inside the browser with all the standard word functionalities loaded.
Regards,
Satyajit.
Hi,
make use of office control.
Pl go through the following blogs
/people/anilkumar.vippagunta2/blog/2007/02/04/office-control-in-webdynpro-ii
/people/anilkumar.vippagunta2/blog/2007/02/01/office-control-in-webdynpro--i
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.