on 03-12-2007 8:07 AM
Hello all,
I want to display a file from the KM.
I manages to get the file content as an IContent object .
How can I use this object to display the file?
If there is a better way to display KM files (not with IContent) I would appreciate information about it as well.
Thanks in advance, Adi.
Hi Adi,
you can use LinkToURL control. We use it for example to display xml
forms files.
You just have to set "text" and "reference" properties.
The "text" property could be assigned for example a file name and
the "reference" property must point to the url of a document in KM.
For example:
...
linkUrlDoc.text = "filename";
linkUrlDoc.reference = "http://"+getServerHostAndPort()+"/irj/go/km/docs/documents/filetodisplay.xml";
where
public java.lang.String getServerHostAndPort( )
{
//@@begin getServerHostAndPort()
WDDeployableObjectPart d = wdComponentAPI.getDeployableObjectPart();
try
{
String url = wdComponentAPI.getURLService().getGeneralService().getAbsoluteWebResourceURL(d);
int index = url.indexOf('/', 8);
return url.substring(7, index);
}
catch(WDURLException e)
{
return "";
}
//@@end
}
Logged user also needs read permissions to that km folder.
Hope this helps,
Regards
Ladislav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adi,
InputStream in = icontent.getInputStream();
DataInputStream dis = new DataInputStream(in);
StringBuffer sb = new StringBuffer();
String line;
while ((line=dis.readUTF()) != null) {
sb.append(line+\n);
}
String finalSring = sb.toString();
bind the final string to some context attribute .
place text edit control and set the value property to the above context attribute.
hope this helps.
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
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.