|
-
Dec 16th, 2002, 03:17 PM
#1
Thread Starter
Member
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
-
Dec 16th, 2002, 06:11 PM
#2
Registered User
If your using Visual Studio.net use the Crystal Report feature.
James
-
Dec 17th, 2002, 09:43 AM
#3
Thread Starter
Member
Output question
Unfortunately, I'm not using the full .NET Studio version, just the VB.NET package solo.
Any ideas code-wise for me?
-
Dec 17th, 2002, 01:43 PM
#4
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:
'open the record set and assign the command results to the recordset before this point
Response.ContentType = "text/csv"
Dim DoneOnce as Boolean = False
while objRS.Read()
if not DoneOnce then
For x = 0 to objRS.fieldCount - 1
response.write(objRS.item(x).key & Microsoft.VisualBasic.vbTab)
Next
Response.Write(Microsoft.VisualBasic.vbCrLf)
DoneOnce = True
End If
For x = 0 to objRS.fieldCount - 1
response.write(objRS.item(x) & Microsoft.VisualBasic.vbTab)
Next
Response.write(Microsoft.VisualBasic.vbCrLf)
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)
-
Dec 17th, 2002, 02:06 PM
#5
Registered User
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|