Textdatei auslesen und formatieren

Tep

Grünschnabel
Hallo ihr Lieben,

ich lese mit flgendem Code ein Verzeichnis aus, worin sich .txt Dateien befinden:

Code:
<html>

<%

u_file=trim(request.querystring("u_file"))
if u_file = "" then

' Get the top level directory info
dir_info = request.servervariables("d:\home\web21\xxx\xxx\xxx-xxx.de\a")

' Get the rest of the directory info without the first /  
dir_info = dir_info + right(request.servervariables("script_name"),(len(request.servervariables("script_name"))-1)) 

' Split the directory info by /
g_input=split(dir_info,"/")

' Count the number of splits
num_inputted=ubound(g_input)-1

set directory=server.createobject("scripting.filesystemobject")
set allfiles=directory.getfolder(server.mappath("../"&g_input(num_inputted)))

' Lists all the files found in the directory
For each directoryfile in allFiles.files 

' Removes ASP pages from view  
if (right(directoryfile.name,3)) <> "asp" then 

set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(directoryfile.name))

read_text = act.readline
act.close

%>
<a href=<%
' Write out the name of the page
response.write request.servervariables("script_name") %>?u_file=<%
' Write out the name of the document
response.write server.urlencode(directoryfile.name) %>>
<%
' Write out the first line of the document
response.write server.htmlencode(read_text) %>
</a><br>
<% 
'End check for any pge other than ASP
end if 

' End for next loop to list documents
next 
' End check for querstring input
else

set fso = createobject("scripting.filesystemobject")

' Check to see if the file in the querystring exists
' (This prevents user input in the address bar from causing errors)
if fso.FileExists (server.mappath(u_file)) then 
' Open the file and read it
set act = fso.opentextfile(server.mappath(u_file))
read_text = act.readall
act.close

' Write the contents of the document ot the browser
Response.Write "<pre>" & server.htmlencode(read_text) & "</pre>"

' If the file in the querystring does not exist
' Display and eror message
else 
%>
There was a problem displaying the requested item<br>Please go <a href=<%= request.servervariables("script_name")%>>back</a> and select again
<%

' End check for file existence
end if 

' End check for querystring value
end if
%>
</span>

Ich möchte nun aber die Ausgabe der jeweiligen Textdatei, also, wenn man draufklickt in die ASP Datei, ausgeben aber gleichzeitig formatiert (Schriftart, Schriftgröße).
Denn momentan wird alles in Times Roman ausgegeben, soll aber in Arila sein.

Wie mache ich das?

Danke
Tep
 

Neue Beiträge

Zurück