Preserving page style and layout when using FSO me

Results 1 to 8 of 8

Thread: Preserving page style and layout when using FSO me

  1. #1

    Default Preserving page style and layout when using FSO me

    Hi guys,<BR>Ive just had my first go at using FSO and found it relatively easy. I have a page which reads a basic .txt file and displays it within the main body of the page. My questions are this. Firstly, it appears that my style is not being preserved to the text from the actual text file itself. Why would this be? How can I correct this?<BR><BR>Also, the text when displayed within the web page is not wrapping neatly within the cell, causing the sizing of the table to expand to accomodate the text. How can this be corrected?<BR><BR>I have just come from the FAQ section, and unless I missed it, could not see these questions answered. If by any chance I did miss it, I apologise, however if not, these questions would be very useful in the FAQ&#039;S section.<BR><BR>Thanks guys,<BR>John

  2. #2

    Default Issues resolved...bit strange?

    Sorry guys. Upon viewing of the HTML output to screen I noticed these unecessary tags "&#060;PRE&#062;" mixed in with the txt file output..<BR><BR>"&#060;table width="100%" height="250" border="0" cellpadding="5" cellspacing="0"&#062;<BR>&#060;tr valign="top" bgcolor="#F8F8F8" class="bodytest"&#062; <BR>&#060;td height="200" bgcolor="#F3F3F3"&#062;<BR>&#060;PRE&#062;AboutWEB Design is a full service..."<BR><BR>Ive just looked again at this page...<BR><BR><BR><BR>and yes those tags are there. Why?<BR><BR>Thanks,<BR>John

  3. #3

    Default Actually, just before I go to bed....

    How is it possible to have the carriage returns acknowledged within the HTML output. By this I mean, If a client were to space the text out or use a number of carriage returns to seperate paragraphs, how can this be displayed as such within the browser? It appears the HTML output simply writes the text file to screen without acknowledging the carriage returns. Is this possible?<BR><BR>Thanks guys,<BR>Goodnight.<BR><BR>John

  4. #4
    Join Date
    Dec 1969

    Default Pre is being used so the file read

    shows as it would if you opened the text file. Formatting within the text isn&#039;t ignored as it normally would be in html. If you are supplying your own formatting (which you clearly are) just remove the pre tags. You don&#039;t need them. <BR><BR>

  5. #5

    Default okay, I now know what <PRE> does, howeve

    ..Im now faced with another issue. How to control the length of each entry? It appears that although the text is now acknowledging carriage returns and line spacing using the &#060;PRE&#062; tag, it does not control the *length* of each sentence. By this I mean a user could enter blah blah blah blah blah blah forever *without* pressing return. This then causes the table to expand to accomodate the text.<BR><BR>How can I resolve this? I would like to now use the &#060;PRE&#062; tag.<BR><BR>Any thoughts,<BR>John

  6. #6
    Join Date
    Dec 1969

    Default So you make up your mind... either WANT to show the text exactly as the user typed it, in which case you use &#060;PRE&#062;, or you don&#039;t, in which case you conver the users NEWLINE characters to &lt;BR&#062; tags, as the FAQ says.<BR><BR>

  7. #7
    Join Date
    Dec 1969

    Default Sorry...the other FAQ...<BR><BR>Or, to make it short:<BR><BR> Set FSO = Server.CreateObject("Scripting.FileSystemObject")< BR> Set infile = objFSO.OpenTextFile(strFileName)<BR> Response.Write Replace( infile.ReadAll, vbNewLine, "&lt;BR&#062;" & vbNewLine )<BR> infile.Close<BR><BR>

  8. #8

    Default BINGO!

    Cheers Bill...its working just how I wanted it. I spent a little bit of time online trying to find the answer, thanks you saved me clicking in circles for another half hour.<BR><BR>Heres what I now have, and it works like a charm.<BR><BR>Dim objFSO<BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR>Dim objTextStream<BR>const strFileName = "C:InetpubwwwrootAboutWEBcontenthome.txt"<BR>c onst fsoForReading = 1<BR><BR>If objFSO.FileExists ("C:InetpubwwwrootAboutWEBcontenthome.txt")then<BR >&#039;The file exists, so open it and output its contents<BR>Set objTextStream = objFSO.OpenTextFile(strFileName, fsoForReading)<BR>Response.Write Replace( objTextStream.ReadAll, vbNewLine, "<BR>" & vbNewLine )<BR>objTextStream.Close<BR>Set objTextStream = Nothing<BR>Else<BR>&#039;The file did not exist<BR>Response.Write strFileName & " was not found."<BR>End If<BR><BR>&#039;Clean up<BR>Set objFSO = Nothing<BR><BR>Could we have this added to the FSO section Bill?<BR><BR>Thanks mate, Im off for a toasted sandwhich and a coffee.<BR><BR>John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts