[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Open Rich Text File in asp

Posted on 2007-10-21
4
Medium Priority
?
991 Views
Last Modified: 2012-06-22
How do you open a rich text file actually read rtf in asp
0
Comment
Question by:thenone
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
NicksonKoh earned 2000 total points
ID: 20120340
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
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q270906&ID=KB;EN-US;Q270906

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") %>

Cheers,
NicksonKoh
0
 
LVL 8

Author Comment

by:thenone
ID: 20120611
doesn't Microsoft Word have to be installed on the clients machine?
0
 
LVL 17

Expert Comment

by:NicksonKoh
ID: 20120637
Yes, either that or have MS Word Viewer which can be freely downloaded.

0
 
LVL 8

Author Comment

by:thenone
ID: 20120647
so ms word viewer has to be installed on the clients machine?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question