Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

put folder list into either a table or perhaps columns 1

Status
Not open for further replies.

optjco

IS-IT--Management
Apr 13, 2004
185
GB
With the help of a couple of "Guru's" on here(seethread333-939286) I have managed to get a list of file names for PDF's from a folder and then open the PDf from there.

Is there anyway i could put these filenames into a table or perhaps multiple columns across the page. the reason I ask is that there may be up to 100 files for a particular customer and rather than the user having to scroll all the way down the page it would be nice to set them out more efficently

Regards

Olly
 
something like this perhaps...
Code:
<TABLE cols="3">
<%
intCount = 0

For each strFile in objFolder.Files
  If InStr(strFile, ".pdf") Then
    intCount = intCount + 1

    If intCount = 1 Then
      Response.Write "<TR>" & vbcrlf
    End If

    Response.Write "<TD><A href='" & strFile & "' target='_blank'>" & strFile & "</A></TD>"

    If intCount = 3 Then
      Response.Write "</TR>" & vbcrlf  
      intCount = 0
    End If
  End If
Next

If intCount > 0 Then
  Do While intCount < 3
    Response.Write "<TD>&nbsp;</TD>"
    intCount = intCount + 1
  Loop

  Response.Write "</TR>" & vbcrlf
End If
%>
</TABLE>

Tony
________________________________________________________________________________
 
Tony,
This is the code I have now for the results page could you perhaps explain how I would incorporate your code into this

Code:
<body bgcolor="#99CCFF">
<%
SearchValue  = Request("txtPrint")
MatchesFound = False ' pessimistic boolean for match finds
  'Create our FSO Object
  Dim objFSO
  Set objFSO = CreateObject("Scripting.FileSystemObject")

  'Stuff our folder into an object we can manipulate
  Dim objFolder
  Set objFolder = objFSO.GetFolder("D:\kiwi-cag\production\CAG")

  Dim Files
  For Each File in objFolder.Files
     If Left(File.Name,3) = SearchValue Then
       Response.Write("<a href=""\\uktmwsa001\kiwi-cag\production\CAG\" &  File.Name & """>" & File.Name & "</a>" & "<br />")
       MatchesFound = True ' something was matched.
     End If
  Next
If Not MatchesFound Then
Response.Write "No Matches Found"
End If
%>

Regards

Olly
 
Here you go - try this...
Code:
<table cols="3">
<%
SearchValue  = Request("txtPrint")
MatchesFound = False ' pessimistic boolean for match finds

'Create our FSO Object
Dim objFSO
Set objFSO = [red]Server.[/red]CreateObject("Scripting.FileSystemObject")

'Stuff our folder into an object we can manipulate
Dim objFolder
Set objFolder = objFSO.GetFolder("D:\kiwi-cag\production\CAG")

Dim [red]File[/red], intCount

intCount = 0

For Each File in objFolder.Files
  If Left(File.Name,3) = SearchValue Then
    intCount = intCount + 1

    If intCount = 1 Then
      Response.Write "<tr>" & vbcrlf
    End If

    Response.Write "<td><a href=""\\uktmwsa001\kiwi-cag\production\CAG\" &  File.Name & """>" & File.Name & "</a>" & "<br /></td>"

    If intCount = 3 Then
      Response.Write "</tr>" & vbcrlf  
      intCount = 0
    End If
    
    MatchesFound = True ' something was matched.
  End If
Next

If intCount > 0 Then
  Do While intCount < 3
    Response.Write "<td>&nbsp;</td>"
    intCount = intCount + 1
  Loop

  Response.Write "</tr>" & vbcrlf
End If

If Not MatchesFound Then
  Response.Write "<tr><td colspan='3'>No Matches Found</td></tr>" & vbcrlf
End If
%>
</table>

Tony
________________________________________________________________________________
 
Tony,
sorry i did not get back to you been away for a few days. I have tried the code as you suggested but I still get the same result with all the files list down the page it does not seem to be making the table.

Any suggestions ??

Regards

Olly
 
Tony,
That works OK now thank you, is there anyway to put a space between the filenames they are showing like this at the moment

ABC_123.PDF ABC_124.PDF ABC_125.PDF

I would like to add some padding if this is possible

Regards

Olly
 
Tony,
Ok sorted that now just used cell padding & cell spacing, I would like to change the font but am unsure how to go about that.

Regards

Olly
 
OK thanks for your help. A star is on it's way

[2thumbsup]:)[2thumbsup]

Regards

Olly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top