POST an unsaved document from word

N

neoret

Hello.

I need a helping hand to help me send an unsaved dokument through a
POST call.

I have added functionality to word and want to send a unsaved document
through a POST call. This works fine when I try sending a saved
document - refering to the path and using a filstream like this:

FileStream fileStream = new FileStream(remoteFolder + filename,
FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[fileStream.Length];
fileStream.Read(buffer, 0, (int)buffer.Length);
fileStream.Close();
memStream.Write(buffer, 0, buffer.Length);

One solution could be to tempsave the document - send it - then delete
it from temp... But I don't think this is a "clean" way to do it.

If you have any tips for me I would really apreciate it!
 
N

Nicholas Paldino [.NET/C# MVP]

The only way I can think of to do this would be to declare the unmanaged
IPersistMemory interface in .NET, and then see if the Document object in
word supports it (through a cast). If it does, you can save the current
document to a byte array and then post that.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top