Downloading a document to a local workstation worked for us. Store it somewhere in the user personal folders folder. Display using software installed on the system.
Get the path to your personal folder using the following command:
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Download the desired file to this path.
Then copy the file to the file like this:
if (File.Exists(fullLocalDocumentPath) == true) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = fullLocalDocumentPath; proc.Start(); }
A configured OS will be used to open the file and display it (based on the file extension). This is not an ideal solution, but it works for us and can suit your needs.
Reservations:
will only display files with extensions that are displayed on the application.
Opens a copy of the application to display the file.
You must provide some mechanism to clear download files from a personal folder.
File extensions that often βworkβ using this technique:
*. doc, * .docx, * .xls, .xlsx (docx and xlsx - Office 2007 and later)
.pdf (everyone has it installed, right?)
.xps (will work if .NET is installed, if a .NET program is running, this will not be a problem)
.txt
Can work:
* .pptx (requires a power point)
Work only if you have special software installed:
Visio, Autocad, etc. files
This may work even if the user does not have Office installed. The user just needs to install free applications for reading from MS.
source share