How to open or view the files .doc .rtf .xls .vso .pdf etc

I use the shellexecute to open anyfile on the computer. it can be word,excel,pdf,visio anything as long as they have the related software on the local machine. This i did using Visual foxpro.

But i want to do something similar using, can you please help me how to do in using or c# as a code behind or inline anything.

as long as i provide the path of the file and use the shell execute with the help of kernel32 and rundll32.dll i should be able to open the file i am guessing, Please help.

following is my visualfoxpro code:

      DECLARE INTEGER GetSystemDirectory IN kernel32.dll ;
            STRING @lsBuffer, ;            INTEGER liSize
      lsSysDir = SPACE(260)  && MAX_PATH, the maximum path length
*-- Get the system directory so that we know
*-- where Rundll32.exe resides.
      liRet = GetSystemDirectory(@lsSysDir, LEN(lsSysDir))
      lsSysDir = SUBSTR(lsSysDir, 1, liRet)        
      lsRun = "RUNDLL32.EXE"
      lsParameters = "shell32.dll,OpenAs_RunDLL "
      liRet = ShellExecute(0, "open", lsRun,lsParameters + tcfilename, lsSysDir, SW_SHOWNORMAL)

Thank you very much for the information.

4/7/2005 7:42:40 PM 91979 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 11

You could simply put a link pointing to the file. The browser will automatically open the file, or it may open in the native application depending on the user's settings. There is nothing more to it.

You could also change the content type of the page to whatever type of file you want to show.


hope this helps,



My Weblogs
4/8/2005 5:30:00 PM

Similar Artilces:

How to create thumbnail images from DOC/RTF/PDF/XLS files
Hello I need to ask if any of you has any knowledge of creating file thumbnails on the fly. I have found a free component but it works only for PDF files, PDFThumbnailer. But my requirement is to convert PDF/DOC/TF/TXT/XLS/PTT files to thumbnails on the fly, and if possible allow to save it as an image for later reference which currently PDFThumbnailer doesnt allow. PDFThumbnailer takes the pdf file and renders an image for it on browser, if that image can also be saved somehow to my machine that would be great too. Please guide me of how to achieve the above requirements. Any help for an...

saving and retrieving various (doc, xls, pdf, etc) files attached to DB row
D7; Sybase ASA 9.0; BDE/ODBC I have a client who wants to attach various document types to rows in the DB. Do I attempt to store them as Blob's or save the document location and open it with its native program? Any suggestions of the best technique, alternate technique or methodology using Delphi 7 or Delphi 2007? Thanks -- Bill Skelton Landmark Data Systems, Inc. Two Old River Place, Suite L Jackson, MS 39202-3435 601-362-0303 Edited by: Bill Skelton on Aug 19, 2008 3:39 PM Bill Skelton schrieb: > D7; Sybase ASA 9.0; BDE/ODBC > > I have a client ...

Securing other file types (image, pdf, doc, xls, etc.) -- mapping to aspnet_isapi doesn't work
I need to secure a directory of various files (images, pdf, avi, doc, ppt, and so on) with forms authentication.   I have tried mapping the appropriate extensions to aspnet_isapi.dll, which seems to work: it won't let me download the file unless I'm logged in.However, when I try to open the downloaded file, it's either blank (in the case of excel or doc files) or causes an error message about being damaged or corrupted (for PDF's).  It is a simple download link directly to the file.  As soon as I remove the mapping to aspnet_isapi.dll, the document works just f...

Opening a file (xls, gif, pdf) using a hyperlink when the webserver and files are in another domain
I have beeen trying to do this for days. I have an IIS server runnning asp.net2.0. The client machines are an a sepearte domain but on the same LAN. The clients can access the .aspx pages without difficulty. One of the pages has a list of dynamically created hyperlinks to files which reside on the IIS server. The hyperlinks are calling 'file://server/share/filename.extension'. I have tried everything to get the clients to open the files in their browsers but it never works. I have used 'logonuser' to log the clients on at adminstrator level on to the IIS server but it still w...

Open .pdf/.doc file
Can someone help me in opening a .pdf/.doc file on the browser using I tried searching but couldnt find some to look up on this topic. Thanks, -sriram I assume that you have successfully uploaded the document into the DB during which you have created a unique docID for each document. To view in a browser, Say you have a hyperlink with text set as the title of the document. When you click it a window opens the doc. For this, Bind the hyperlink to the document's name (from the DB) and also retrieve the unique ID in the dataset. Then set the navigateurl prope...

Open PDF and Doc files
I have a page that displays and browse the file system. it works fine, now I am trying to select a file and click on it to open it. I try to use the Filestream to open a file but it is no working, am I missing something? Code: FileStream fileStream = new FileStream(@"c:\my file.pdf", FileMode.Open); Gus G. i'm not sure if it works for pdf, but it works for .doc files. Here it is.. Dim iStream As System.IO.Stream iStream = New System.IO.FileStream(filepath, System.IO.FileMode.Open, _ IO.FileAccess.Read, IO.FileShare.Read)   Where filepath is your absolute path of file. Hop...

Download a file from sql (doc, txt, xls, pdf) files available in the db to be displayed in a datagrid, gridview, ...
Every search that I come up with is wanting to save the results displayed in the datagrid.  My page would be a list of all documents stored in the database.  Actually what is stored in the database is just a webpath on the server. My sql table has for columns - DocsID , ProjectID, Title, Webpath I was looking for a grid that looked something like this:                                    DocsID &nb...

Trying to get to open file on remote server
The title is kind of lame. What I'm doing is that I had been developing on the production server (don't ask), and now I've moved development to my workstation. I have a bit of code in an aspx the opens a pre-formatted html and puts it into a label. The code is as follows. Dim FILENAME As String = "D:\Inetpub\wwwroot\articles\news.htm" Dim objStreamReader As StreamReader objStreamReader = File.OpenText(FILENAME) articles.Text = objStreamReader.ReadToEnd() objStreamReader.Close() This worked fine and the aspx on the product...

Unable to view Doc and XLS files.
Since upgrading to GW6.5sp4, (all agents) we are unable to view Microsoft XLS and DOC files. PDFs are ok. When viewing, the charectors are random and looks a lot like: #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).\ Anyone else? Tried deleting sys:system\sccfilt.bin and sccopt.bin, then unload/restart the gwinter. ....did not work. You are missing the .vew files in the system folder or wherever you have your agent installed. You can manually copy them from the SDD or re-install the WebAccess agent. Connie W "Jeff Moreau" ...

PDF files and DOC files
Name: Jeff Kopacz Email: Product: Firefox Summary: PDF files and DOC files Comments: When using Firefox and have to view a pdf file or Doc file I have to have Adobe Reader or Word started before selecting the file or the computer will lockup. I am using XP and Firefox 1.0.7. If I use either IE or Netscape they will open properly. This has recently occured with either version 6 or 7 Browser Details: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 ...

*.txt or *.doc files ? how can i get my record of table1 to *.txt or *.doc files?
hi friends i have table1. and i have username(varchar15) and name(varchar15) and userid(integer) as columname.. and i have 300 records in table1 i want to create *.txt or *.doc files and get my records to *.txt or *.doc files.. i also want to get back my records in *.txt or *.doc to table1 :) how can i do this ? SincerelyMark as me if my question or my answer can be helpful for you :) How would you like to.  My first choice would be a DTS job that exports comma delimited text, but it's easy enough to write this in a lot of different ways. JeffPlease: Don't forget to clic...

How to close an open txt ( or pdf etc...) file ?
Hello , I've a simple but never faced before question : how can i close a txt,pdf, doc file ? I need to write a new pdf(txt etc..) file, I delete the existing file ( if it is present ),and after create it, wrtie it and so on. But if the file is open , the File.Delete instructions raise an exception, so i want to close it before and then delete it. Thank you in advance for your help.//Mark my post as answer if this helped you.Thanks!\\ How are you writing it?  There should be a close method to whatever is writing it- DavidPlease click "Mark as Answer" on all post...

Open/View PDF file stored in database
Can a PDF file saved in the database or on a network drive be opened in a webform project? If so, how would that be accomplished? Thanks in Advance, Lisa ---== Posted via the PFCGuide Web Newsreader ==--- This is a multi-part message in MIME format. ------=_NextPart_000_016F_01C95662.67479CE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes and No. Yes, the PDF saved in DB can be read from blob in database and written = out to the virtual filesystem provided by ...

how to open file (.doc or .xls ) in another window
hi friends i have a link button on click of that i want to open a file(.doc or .xls or .jpg or etc) from particular folder within that project. i will get file name from the name of link buttton. i want to open this file in seperate page or explorer. currently i am using javascript Dim strScript As String = "'" & ln & "','dtl','width=600,height=500,left=10,top=10,scrollbars=1') " Response.Write(strScript) but only .jpg files are opening plz help me out By not opening what do you mean? Does your popup window give y...

Web resources about - How to open or view the files .doc .rtf .xls .vso .pdf etc -

File:Commons-logo.svg - Wikipedia, the free encyclopedia
This image, or parts of it, is an official logo or design used by Wikimedia Foundation or by one of its projects. It is copyrighted by the Wikimedia ...

tar (file format) - Wikipedia, the free encyclopedia
. tar was initially developed to write data to sequential I/O devices for tape backup purposes. It is now commonly used to collect many files ...

The Fitz Files: NRL decision about Sam Burgess deal with South Sydney exposes problem with salary cap ...
Let us call the salary cap what it is: an illegal cartel between employers to limit the earning capacity of its employees.

Former student to file human rights complaint over UBC's sexual assault policy
A former University of British Columbia graduate student plans to go the province's human rights tribunal over what she calls the school's broken ...

Al Roker Files Complaint After Cab Incident
Today Show co-host Al Roker says he filed a complaint Saturday after a New York City cab driver refused to pick him up–but stopped for a white ...

Viber now lets you attach files, delete messages and more
... messaging and public chat forwarding in late September , the app keeps growing. In an update today, Nov. 24, Viber users can now attach files, ...

The biggest targets of copyright takedown requests on Google are file sharing services
... 2.2 million takedown requests every day for sites with content that someone claims is pirated. Among the most complained about sites are file ...

Comcast Can Interrupt Your Web Browsing With Warnings About Potentially Illegal File-Sharing
... to GitHub , showing how Comcast is now injecting these warnings into customer’s web browsers when they believe that some sort of illegal file-sharing ...

Planned Parenthood files suit against Texas for trying to boot them off Medicaid
... organization while distributing $2.8 million in federal dollars. […] The legal challenge in Texas is the latest in a series of lawsuits filed ...

3D printing files for guns are illegal in an Australian state
The Australian state of New South Wales has made it illegal to possess the blueprints necessary to make your own projectile weapons. Lawmakers ...

Resources last updated: 12/1/2015 2:27:21 AM