|
-
Sep 9th, 2010, 02:40 AM
#1
Thread Starter
Fanatic Member
Creating Crystal Reports Programatically
Is it possible to create crystal reports in vb.net programatically at run time? There will be no typed dataset because I don't know what fields will need to be in it until the user clicks "Print".
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Sep 9th, 2010, 03:27 AM
#2
Re: Creating Crystal Reports Programatically
 Originally Posted by simonm
Is it possible to create crystal reports in vb.net programatically at run time? There will be no typed dataset because I don't know what fields will need to be in it until the user clicks "Print".
Hi,
You can find some example, here.
-
Sep 9th, 2010, 05:01 AM
#3
Re: Creating Crystal Reports Programatically
There is a tutorial on Crystal in this link about half way down.
http://vb.net-informations.com/
-
Sep 9th, 2010, 07:38 AM
#4
Thread Starter
Fanatic Member
Re: Creating Crystal Reports Programatically
I see an example of how to create a crystal report dynamically from an SQL string. But the problem I have is that the data does not exist in the database, only in an ADO.NET data table. I suppose I could save the data to a temp table and then generate an SQL string based on that but I imagined I might be able to merely bind the report I created to my data table directly.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Sep 9th, 2010, 07:51 AM
#5
Re: Creating Crystal Reports Programatically
In the link I posted there is a section "Crystal Reports without database". Maybe there is something there that can help.
-
Sep 9th, 2010, 08:40 AM
#6
Re: Creating Crystal Reports Programatically
Yes, it's very possible. First, save your ADO.NET DataSet/DataTable's schema using:
myDataSet.WriteXml("C:\schema.xml", XmlWriteMode.WriteSchema)
Then, make a new Crystal Report, tell it your datasource is ADO.NET, and pick your schema file. You'll see the report builder populated with all the tables and fields from your DataSet. If you ever need to make a change to your DataSet, just re-export the schema, and re-import it into the Crystal Report.
-
Sep 9th, 2010, 08:43 AM
#7
Thread Starter
Fanatic Member
Re: Creating Crystal Reports Programatically
 Originally Posted by Jenner
Yes, it's very possible. First, save your ADO.NET DataSet/DataTable's schema using:
myDataSet.WriteXml("C:\schema.xml", XmlWriteMode.WriteSchema)
Then, make a new Crystal Report, tell it your datasource is ADO.NET, and pick your schema file. You'll see the report builder populated with all the tables and fields from your DataSet. If you ever need to make a change to your DataSet, just re-export the schema, and re-import it into the Crystal Report.
I think you misunderstand my requirement. The schema will change everytime (potentially) the user prints the report.
What I'm trying to do is generate a report from the contents of a list view who's columns can be configured by the user.
Thinking about it now, I'm inclined not to bother with Crystal and look at printing directly, perhaps using the PrintDocument control...
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Sep 9th, 2010, 09:22 AM
#8
Re: Creating Crystal Reports Programatically
Yea, best to just build it on the fly with PrintDocument. Crystal is very precise with what it wants. It doesn't have the equivalent of a FlowLayoutTable to dynamically stack and arrange columns.
-
Sep 9th, 2010, 09:23 AM
#9
Thread Starter
Fanatic Member
Re: Creating Crystal Reports Programatically
Can you recommend a good reporting engine that does?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Sep 9th, 2010, 10:48 AM
#10
Re: Creating Crystal Reports Programatically
I think you could write it to a CSV file and feed that to Crystal.
-
Sep 9th, 2010, 12:04 PM
#11
Frenzied Member
Re: Creating Crystal Reports Programatically
You might want to look into ActiveReports. I think you might be able to do what you want with that reporting utility.
Justin
-
Sep 9th, 2010, 12:49 PM
#12
Re: Creating Crystal Reports Programatically
SSRS report templates are XML and can be generated/manipulated at run time.
-
Sep 13th, 2011, 04:14 AM
#13
Thread Starter
Fanatic Member
Re: Creating Crystal Reports Programatically
 Originally Posted by MonkOFox
You might want to look into ActiveReports. I think you might be able to do what you want with that reporting utility.
Justin.
Yeah, I've ended up doing that already! That's far more programatically interactive.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
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
|