Create Fixed Length Text File in ASP

Results 1 to 2 of 2

Thread: Create Fixed Length Text File in ASP

  1. #1
    Join Date
    Dec 1969

    Default Create Fixed Length Text File in ASP

    Does anyone know how to create a "Fixed Length" or "Column" delimited file from information that is gathered on an ASP page or form? Any suggestions, ideas or sample codes are greatly appreciated.

  2. #2
    Join Date
    Dec 1969

    Default Easy enough... just need to pad each field/column to the specified width.<BR><BR>And padding is easy with the VBScript SPACE function. Look it up. (Click on "VBScript Reference" in left panel of this page, then on "Functions" in topics that appear, then on function name.) Or maybe even better is to just use a constant sized pad and then use LEFT to chop to size.<BR><BR>Probably best to create your own pad function and then your own "buildOneLine" function.<BR><BR>e.g.:<BR><BR>&#060;%<BR>CONST padding = " "<BR>Function Pad( val, size )<BR> Pad = Left( val & padding, size )<BR>End Function<BR><BR>Function BuildLine( name, address, city, state, zip, phone )<BR> BuildLine = Pad(name,20) _<BR> & Pad(address,30) _<BR> & Pad(city,10) _<BR> & Pad(state,2) _<BR> & Pad(zip,5) _<BR> & Pad(phone,10)<BR>End Function<BR>%&#062;<BR><BR>

Posting Permissions

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