Skip to Content
author's profile photo Former Member
Former Member

Word document contents blank

Hi ,

I have made an application where I am using OfficeUIElement,below is the code which I have written in the source function(fillNode) of the view context which will hold document content in binary format.I am getting the output in the sense that the Office element comes integrated in the view but it does not read the data of the file location which i have specified,the output is blank.

Any inputs on what I am missing?

IWDAttributeInfo attrInfo =


ISimpleTypeModifiable simpleType = attrInfo.getModifiableSimpleType();

IWDModifiableBinaryType binaryType =

(IWDModifiableBinaryType) simpleType;

binaryType.setMimeType(new WebResourceType("doc", "application/msword", false));

IPrivateWordCompView.IDocumentSourceNodeElement element = node.createDocumentSourceNodeElement();

try {

byte[] bytes = getBytesFromFile(new File(""));




public static byte[] getBytesFromFile(File file)

throws IOException


FileInputStream is = new FileInputStream(file);

long length = file.length();

byte[] bytes = new byte[(int)length];

long bytesRead =;

if (bytesRead < length)

{ throw new IOException("Could not completely read file "+file.getName());



return bytes;


public void wdDoInit()




Maybe I am missing a small thing,so any suggestions are welcome.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 01, 2005 at 12:19 PM

    The problem is here

    new File("")

    Try to use URL / URLConnection class -- file object could not load content by HTTP


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Mandeep,

      Check if you have named your UI element something else other than OfficeControl1 as in this method:



      Somehow this doesn't throw any exception you specify the wrong element ID. Could make such an error when going directly by the example.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.