Showing results for 
Search instead for 
Did you mean: 

image inside word doc through webdynpro

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi Cavita

The src attribute "/home/erecuser/eRecLogo/524796671.jpg" shall contain URL instead of the local server path. If the image is located in MIMES folder of your WebDynpro application use WDURLGenerator to get URL of the image.

BR, Siarhei

Former Member
0 Kudos

my image is stored in /home/erecuser/eRecLogo/ on same server on which application is running. how to get complete url path for this location?

Edited by: kavita chavan on Apr 9, 2010 12:55 PM