How to Display a Word Document in ASP

How to Display a Word Document in ASP thumbnail
Displaying a Word document in ASP will save hours of retyping files and data into ASP.

ASP stands for Active Server Pages. Microsoft ASP is a Web scripting language that can access many Microsoft Office files. This program can create Web applications, dynamic websites and Web application services. ASP also allows sequences of mouse clicks to be condensed into one click to save time. ASP.Net can program macros and allow users to read and edit Word Documents.

Things You'll Need

  • Text editor
  • MS Word document
  • ASP program
Show More

Instructions

    • 1

      Open a text editing program. Notepad or WordPad will work if no other editors are available. On Windows operating systems, Notepad and WordPad are located in the "Accessories" folder. Click on the "Start" menu and open the "Program Files." Click on "Accessories" and select either "Notepad" or "WordPad" from the list.

    • 2

      Select "Open" from the "File" menu and browse for the Word document you wish to display. Click on the name of the document and select the "Open" button.

    • 3

      Save the file as an .asp or .aspx file. Click on the "File" menu and select "Save As." Choose the location and name of the saved file and then select .asp or .aspx from the drop-down menu under the location window. Click on the "Save" button.

    • 4

      Open the ASP program from the program files or the desktop. If the program is not on the desktop, Click on the "Start" Menu, select "Programs" or "All Programs" and scroll through the list for "Microsoft ASP."

    • 5

      Click on the "File" menu and select "Open." Locate the file you saved in the text editor and click "Open."

    • 6

      Copy and paste or type the following code above the first line of the document. To copy and paste, highlight the code, hit the "CTRL" and "C" keys at the same time, click inside the document you want to paste to and hit the "CTRL" and "V" keys at the same time.

      private Word.ApplicationClass WordApp = new Word.ApplicationClass();

      if (this.openFileDialog1.ShowDialog() == DialogResult.OK)

      {

      object fileName = openFileDialog1.your file;

      object readOnly = false;

      object isVisible = true;

      object missing = System.Reflection.Missing.Value;

      WordApp.Visible = true;

      Word.Document aDoc = WordApp.Documents.Open(ref your file, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);

      aDoc.Activate();

      }

    • 7

      Replace all references to "Your File" with the name of your saved file.

    • 8

      Save the file as an .asp or .aspx file. Click on the "File" menu and select "Save As" from the available options. Your file can now be displayed in ASP or uploaded to the Internet.

Related Searches:

References

Resources

  • Photo Credit papers image by Dmitry Nikolaev from Fotolia.com

Comments

Related Ads

Featured