I want to print a receipt in wpf with out using report viewer or crystal report. I want to use only print dialog box in wpf.
Asked
Active
Viewed 760 times
-3
-
You could build a flowdocument and print that. Printing has a couple of gotchas: https://stackoverflow.com/questions/345009/printing-a-wpf-flowdocument Or you could show as wpf controls in a container like a grid and then rendertargetbitmap to a png file and print that. – Andy Apr 23 '18 at 09:25
-
I want to print invoice that contain header and footer and some item detail – Ali Hamza Apr 23 '18 at 09:27
-
Crystal reports is very good for that sort of thing, you realise you can print directly without first showing in report viewer? https://stackoverflow.com/questions/17377281/how-to-directly-print-a-report-without-going-through-crystal-reports-viewer – Andy Apr 23 '18 at 09:31
-
How crystal report add in wpf application – Ali Hamza Apr 23 '18 at 09:32
-
SAP offer a free version for vs developers. https://www.sap.com/uk/products/crystal-visual-studio.html – Andy Apr 23 '18 at 09:35
-
crystal report work as just like report viewer or not – Ali Hamza Apr 23 '18 at 09:38
-
How we upload data in crystal report? – Ali Hamza Apr 23 '18 at 09:39
1 Answers
0
Here's a snippet of code showing very simple usage of crystal. This has a reportviewer involved, but that is optional as I explained in comments.
ReportDocument rpt = new CrystalReport1();
Person person = new Person
{
JobTitle="Director",
Gender="M",
HireDate = new DateTime(2015,1,1)
};
List<Person> OnePerson = new List<Person>();
OnePerson.Add(person);
rpt.SetDataSource(OnePerson);
crystalReportViewer1.ReportSource = rpt;
crystalReportViewer1.Refresh();
Here CrystalReport1 is in my solution like any class or window and I've designed it there.
That can be built against any table stored procedure view or class. If you work vs a database then you could use odbc to read from there but this is rarely a good idea and you're best getting the data externally.
So long as you present data to the report which has the same fields with matching types in it then it'll take a List even if you design against a database. This means you can easy set up a dummy table with data in it and prototype quickly. Then later switch over to an entirely different source.

Andy
- 11,864
- 2
- 17
- 20
-
SAP Crystal Reports Runtime (64Bit) SAP Crystal Reports runtime engine for .NET framework (64Bit). No IDE integration – Ali Hamza Apr 23 '18 at 10:03
-
-
-
I don't follow what you mean reference for XAML. The reporting part isn't reliant on any ui. Runtime engine is just for users, no designer. You will want a version that allows you to design in visual studio. – Andy Apr 23 '18 at 10:15
-
-
Tell me the direction at which I am going. Is it a right version that I download – Ali Hamza Apr 23 '18 at 10:20
-
IDE integration means Visual Studio integration. No IDE integration would be bad. Not sure about what size which version is but you want IDE integration. – Andy Apr 23 '18 at 10:27
-
The linq that you send there is a option that installation package for visual studio IDE – Ali Hamza Apr 23 '18 at 10:32
-