PDA

View Full Version : Mimic Document(.doc) downloading on a windows form


ICEOverDose
06-24-2009, 12:17 AM
Hello All,

I am trying to open a document on a network drive.

Usually I am coding on ASP.NET so I use a sort of download technique. The .doc would be downloaded by the user and if they click open it would be just a temp copy in their temp internet files. and they can save a copy if they want or print it.

I like it this way because they wont be able to edit the document. There wont even be a reference to the original document on the network drive so there is complete separation.

So I made a quickie utility to look up documents for me and now I want to be able to view them in a similar way as I am used to on ASP.NET.

I was thinking about something like this:

Dim appWord As New Word.Application
Dim docWord As New Word.Document
Dim readOnly As Object = False
Dim missing As Object = System.Reflection.Missing.Value
docWord = appWord.Documents.Open(File, missing, [readOnly], missing....)


That completely works. However I would feel a lot safer if there was a way to maybe copy the file into a memory or a temp directory like the download method in ASP.NET.

Has anyone ever seen something like this? I have been searching for a while now and haven't found anything very useful. Except maybe (in code) copying the contents to a clipboard and pasting it into a new doc you make in code. This isn't working as smoothly as I had hoped and it is erasing a lot of the formats.

I'd appreciate any leads or info you could provide.

thanks,
Daryl