Results 1 to 5 of 5

Thread: Output question

  1. #1

    Thread Starter
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52

    Output question

    Is there an easy way to output a filled-in datagrid to Excel via code? If not, what about converting the datagrid to a printable format (such as PDF)?

    If you couldn't guess, I'm trying to simply export a grid into a "printer friendly format". Any tips?

    Thanks...Ooogs

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    80
    If your using Visual Studio.net use the Crystal Report feature.

    James

  3. #3

    Thread Starter
    Member Ooogaleee's Avatar
    Join Date
    Nov 2002
    Location
    Jacksonville, FL
    Posts
    52

    Output question

    Unfortunately, I'm not using the full .NET Studio version, just the VB.NET package solo.

    Any ideas code-wise for me?

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    If it were me (and I know its not) I would have a link on the page that calls another page. This other page would loop through a data reader and output the data as a comma-seperated values file.

    The following is off the top o me head and probably won't run "out - of - the - box" but it should get you on-track with how you would do it (this is in that other page)

    VB Code:
    1. 'open the record set and assign the command results to the recordset before this point
    2. Response.ContentType = "text/csv"
    3. Dim DoneOnce as Boolean = False
    4. while objRS.Read()
    5. if not DoneOnce then
    6. For x = 0 to objRS.fieldCount - 1
    7. response.write(objRS.item(x).key & Microsoft.VisualBasic.vbTab)
    8. Next
    9. Response.Write(Microsoft.VisualBasic.vbCrLf)
    10. DoneOnce = True
    11. End If
    12. For x = 0 to objRS.fieldCount - 1
    13. response.write(objRS.item(x) & Microsoft.VisualBasic.vbTab)
    14. Next
    15. Response.write(Microsoft.VisualBasic.vbCrLf)
    16. End While
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    80
    If you have Adobe Distiller you can create pdf files. Then have the users download them to the adobe reader plugin. They will be able to print with the plugin.

    James

Posting Permissions

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



Click Here to Expand Forum to Full Width