Skip to Content
Former Member
Mar 05, 2010 at 08:10 AM

image inside word doc through webdynpro


Hi All ,

I am working on WebDynpro Java Application. In my application i have some data in node which i want to display as word doc along with one image saved on server.

i have written following code for the same

StringBuilder htmlCode = new StringBuilder();

htmlCode.append("<html><body><p>An image from another folder:</p><img src=").

append("/home/erecuser/eRecLogo/524796671.jpg").append("width=\"33\" height=\"32\" /></body></html>");

WDResourceFactory.createCachedResource(htmlCode.toString().getBytes("UTF-8"), "MyImage.doc", WDWebResourceType.DOC).download(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal());

when i run this code word doc is opening but not able to view image. My image is saved at location /home/erecuser/eRecLogo/524796671.jpg inside root directory on same server on which m running application. Please let me know how to resolve this issue or is there ant other way to show these details along with image as DOC file through WebDynpro Java

all files are saved as follows

String fileExt = resource.getResourceType().getFileExtension();

InputStream text =;

//InputStream text =;

int temp = 0;

String filePath = "";

String fileName = "";

filePath = "/home/erecuser/eRecLogo/";

filePath = filePath+wdContext.currentContextElement().getFileName();

File osFile = new File(filePath);

FileOutputStream fileOutputStream = new FileOutputStream(osFile);



// New added

int l_int_NoOfBytes = text.available();

byte[] byteArray = new byte[l_int_NoOfBytes];

int l_int_byteRead =, 0, l_int_NoOfBytes);


// New added ends



Thanx in advance


Edited by: kavita chavan on Mar 5, 2010 9:54 AM