on 02-26-2007 8:34 AM
Hello Experts,
I have a requirement to generate word document using Web dynpro. This word document is a word template & everytime I execute web dynpro, data should be retrieved from the database tables & populated in the empty columns in the template.
Can anyone let me know if this is possible ? Would appreciate if any help / sample code is recieved.
Thanks,
RB
Hi,
Create a single view with Text area,a button and a LinkTOUrl UI element. Write the following code on click of button. and set the refrence property of LinktoUrl equals to Url and value property or textedit to doc.
Note : Here Doc and Url are the value attribute of string type.
public void onActionConvert(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionConvert(ServerEvent)
final String formattedStr = wdContext.currentContextElement().getDoc();
try
{
final IWDCachedWebResource resource = WDWebResource.getWebResource
(
formattedStr.getBytes("UTF-8"), WDWebResourceType.DOC
);
resource.setResourceName("WordDoc.doc");
wdContext.currentContextElement().setUrl( resource.getAbsoluteURL() );
}
catch (final Exception ex)
{
wdComponentAPI.getMessageManager().reportException( new WDNonFatalException(ex), false );
}
//@@end
}
Write some info in text area and click the button.
and then click on LinktoURL UI element, it will ask you to save or open the word document.
hope it helps,
Regards,
Abhijeet.
Message was edited by:
abhijeet mukkawar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajeshree,
please see this weblog:
/people/valery.silaev/blog/2005/11/23/display-formatted-text-using-webdynpro-for-java
You can also use the Java API to Handle Microsoft Word Files:
http://jakarta.apache.org/poi/hwpf/index.html
Hope this help you,
Vito
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
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.