on 03-02-2005 10:44 AM
Hi all,
I hope someone got a quick an easy solution for this one.
I want to access and display (open/save) a .doc file in a new separate window by using createExternalWindow(docUrl, xxx, xxx), where docUrl is a path on the local webAS. Right now I access the file like this:
File doc = new File("apps/local/filename.doc");
wdComponentAPI.getWindowManager().createExternalWindow(doc.getURL(), "", false).open;
This does not work though, since it gives me the absolute path from the hard drive letter and down, ie: c:/usr/sap/../filename.doc
We havent installed Office Integration on our webAS.
Anyone? All help help is appreciated. This doesn't feel like it should be a big issue?!
Best regards,
Andreas
Andreas,
Here is probably not the optimal and not the most intuitive way to perform this task, but anyway:
1. In View controller context create attribute with type <b>binary</b>, let us name it <b>MyDoc</b>
2. In View controller source define private variable
private ISimpleType _msWordType
3. In View controller wdDoInit method place the following:
_msWordType = wdContext
.getNodeInfo()
.getAttribute("MyDoc")
.getModifiableSimpleType();
((IWDModifiableBinaryType)_msWordType).setMimeType( WDWebResourceType.DOC );
((IWDModifiableBinaryType)_msWordType).setFileName( "MyMsWordDocument.doc" );
4. Use the following docUrl when calling createExternalWindow
/* Load document content first */
final byte[] documentContent = loadDocumentBytes();
/* And now the trick itself */
final String docUrl = _msWordType.format( documentContent );
We successfully apply this technique to display photo from employee profile loaded from database
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Valery!
Thanks very much for your input!
I will be sure to try that out as well.
Right now I put the word documents I want to be able to access in src/mimes/Components and deploy them with the rest of the application. This was the advice I got from SAP. It's a fairly straight forward solution, but I like yours better!
Best regards,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It also seems I don't use the correct object name. What is this referring to? My project name, app name, my fully qualified name (ie dev.test.app)?
Best regards,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx for your replies!
It sure sounds like the thing I want to do, but so far I haven't been able to successfully load my word document.
Seems it's supposed to be put in a folder /webdynpro/resources on the app-server, but I can't even find this directory? Where is it supposed to located? Thanks!
Best regards,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Take a look at the IWDURLGenerator API. You probably want to use the method getAbsoluteWebResourceURL().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Small correction: It's a class, so it is named WDURLGenerator. See:
<a href="
">https://media.sdn.sap.com/javadocs/NW04/SP9/webdynpro/com/sap/tc/webdynpro/services/sal/url/api/WDURLGenerator.html</a>
Armin
User | Count |
---|---|
91 | |
10 | |
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.