locked
How to work with Word 2007 programmatically RRS feed

  • Question

  • User751785559 posted

    Hey guys,

         I apologize in advance if this is not the correct forum, but it looked as appropriate as any.

    Situation - using VB.Net and VS 2005 with Office 2007. I need to programmatically create a Word document and send it to another site.

    Problem - it all works, but when the user tries to open the file, they get a message saying it's corrupt.

    I'm using the correct distributable interop for Word 2007 and have all the permissions I would ever need. Even trying to send an existing file does not work.

    Question - what is the right way to work programmatically with Word 2007 so my files will not be corrupt when they are sent? Currently, I am using a stream object to get the file size, create a byte array of that size, read the file into it and send it.

    What do I need to know to work with Word 2007? Using OOXML classes make no difference.

    Thanks is advance. 

    Tuesday, October 27, 2009 11:47 AM

All replies

  • User751785559 posted

    Problem solved.  The web app was written in VB.Net with Option Strict on.  I normally work in C#. As soon as I turned it off, I was able to create a byte array with a size of long integer and the problems went away.

     

    Thanks anyway.

    Wednesday, October 28, 2009 11:51 AM