• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1016
  • Last Modified:

Open Rich Text File in asp

How do you open a rich text file actually read rtf in asp
  • 2
  • 2
1 Solution
Hi thenone,

Rich Text files can also be open as text files. However, like HTML, it contains "tags" to give format the text. A example can be read from

If you are trying to open a rich text file in the browser, then it can done by by forcing the rich text to be opened with MS Word since Word can interpret rich text files.
Place the below code at the top of the page and then you can use FileSystemObject to read the rich text file.
<%Response.ContentType = "application/msword"%>
Function ReadFile(filename)
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
      If objFSO.FileExists(Server.MapPath(filename)) Then
            Set objTStream = objFSO.OpenTextFile(Server.MapPath(filename), ForReading)
            strText = objTStream.ReadAll
            Set objTStream = Nothing
            Set objFSO = Nothing
            ReadFileOrig = strText
      End If
End Function
<% Response.Write ReadFile("YourRichTextFile.rtf") %>

thenoneAuthor Commented:
doesn't Microsoft Word have to be installed on the clients machine?
Yes, either that or have MS Word Viewer which can be freely downloaded.

thenoneAuthor Commented:
so ms word viewer has to be installed on the clients machine?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now