I asked a similar question yesterday. I have a large MS Access application that I want to convert into C#. On the whole I'm doing ok, but it's become apparent to me that I've got problems when formatting reports. Yesterday I was asking about changing a report title at runtime. I came up with a workaround for that. However, MS Access allows you at runtime to create, move, hide, reveal and resize report controls. In particular, my MS Access application constructs barcodes in reports at runtime. In the report I have an array of lines that my code places and resizes in order to construct the barcode. As far as I can see, this is completely impossible in a Visual Studio report. Do I have any options here? For instance are there any competent 3rd party solutions?
You have a couple of options.
You can use a 3rd party custom report item like Aspose Barcode for Reporting Services.
You can dynamically generate an image with embedded code.
Note: I've never attempted the 2nd option, but it seems like it has potential to be an easy way to dynamically generate images for a report...
Related
First of all I want to say hi to the programming community, what I am looking for is a way to generate a report from my Windows Forms Application in word preferably, this report is basically a list of pre-configured days in a tour creation software I am creating.
I have searched everywhere and I cant seem to find information on how to start creating the report, I have all the information saved into a database, I just need to be able to get this information into word and ordered as it should be ordered.
I just want to be pointed in the right direction so I can research on it even further.
The exact thing I want to create is a word file that I wish I could share here so you can actually see what I mean.
Thank you for all your attention and help if possible.
I can point you in the right direction. Word documents are stored in a format called OpenXml which can be created and manipulated without actually using Word directly. That's good because you don't want to deal with code that actually starts an instance of Word and automates it (Interop.) It sort of works but it's not something I recommend dealing with ever.
OpenXml isn't fun either, but it's better. You can create your document "normally" using Word, save it, and then have your application use it as a template, opening a copy, populating some data, and then saving it.
Here's the reference for OpenXml with Word. I'm not saying it's pretty. It's not. The documentation is lacking. This page on adding text isn't linked from the previous page, even though many other topics are.
There are some nuget packages like this one that can help.
I once did a POC that did exactly what you're describing by opening and altering a document used a template using OpenXml. I'll see if I can dig up the code. But this is definitely a good direction to look in if Word is an absolute requirement.
This is a long shot, but can you output in HTML? If you can that's an even easier alternative.
Can you use Excel? That's also OpenXml but there's easier-to-use tools like EPPlus that simplify dealing with it, because it's not just the friendliest thing to work with.
An option that I would suggest is Crystal Reports. You can download the Crystal Reports add-in for Visual Studio for free from here. Crystal Reports is an easy way to perform reporting from various data sources including SQL. There are also a lot of free tutorials online for learning how to use CR. The syntax is a little strange, but it is easy enough to use.
The add-in allows you to create reports for your application and also build applications that can display, print, and export Crystal Reports.
You can export reports to .RTF (Rich Text Format) files. MS Word can open, edit, and convert RTF documents. It does a fairly decent job, but special formatting might take some work. This route is a ton easier than trying to write XML or anything else. I've written several reports designed for export to RTF. My boss runs the report, exports it, then edits it in Word. He loves the reports.
If you are planning on developing a lot of reports, purchasing the full version of Crystal Reports is well worth it. I believe they are on version 2016 currently.
If you do want to deal with automating Word, Microsoft's guide "Automating Applications Using the Office Object Model" Word-specific task content is here: https://msdn.microsoft.com/en-us/library/78whx7s6(v=vs.80).aspx
A larger example: https://support.microsoft.com/en-us/kb/316384
To begin, simply add an assembly reference to your project file for the correct Office Object Library (example: "Microsoft Word ##.0 Object Library"). Note that you must have Office installed to take this approach.
Good luck!
I am developing an application in C# that will generate a variety of reports. I would like to give the user the option either save the report as a PDF or print the report DIRECTLY FROM THE APPLICATION (i.e., not saving then printing).
I was under the impression that PdfSharp and MigraDocs would provide this functionality, so I have developed my report in PdfSharp. Now that I have a PDF report, but I cannot figure out how to print it without saving it first. I don't mind starting over and redeveloping my reports using a different tool, as the logic will be generally the same, but I don't want to have to develop and maintain 2 different sets of instructions depending on whether the user is saving or printing.
I have also investigated using a System.Drawing.Printing.PrintDocument and MirgraDocs, but I don't think it will be dynamic enough. I have also investigated Spire.Pdf, but the free version does not appear to be compatible with WPF.
Since this will be deployed on multiple machines, I would like to use DLLs as opposed a third party executable.
i am presently working on a project to generate invoice reports in visual studio 2010.
I am confused whether to use crystal reports or reporting services(rdlc) to generate reports.
The reports are required to be generated for a manufacturing unit(print, save all options are necessary).
Which one is better to use as per my needs?
If you're printing invoices, I would consider using Crystal Reports first. It will allow for easier formatting and viewing within a Windows app.
If you know Reporting Services REALLY WELL, you can accomplish what you're wanting to do, but if you're new to both, I believe you'll be happier in the end using Crystal Reports. You will get better, easier results with less effort.
Your question is open for debate, so this is only an opinion.
I would go with the local reporting services (RDLC) and only use the full blown report server when necessary. You have a viewer for RDLC with options to print and save in various formats and you can easily stream the reports to PDF.
The version of Crystal that comes "stock" with VS is limited and the full versions are a bit pricey for my taste. I have been able to do everything I have needed with reporting services.
Please take a look at Windward Reports. It will save you a lot of time compared to Crystal or SSRS. And you can do more with it.
The unique difference is with Windward you design the reports in Microsoft Word, Excel, or PowerPoint. So it's a very powerful easy to use design tool you already know. And because Word/Excel/PPT are free-form, you can do most anything for your final report.
I'm going to disagree with everyone (so far). I am not familiar with Windward Reports, so I won't comment on that, but I am familiar with Crystal Reports in VS2005. It is clunky, difficult to use and comes with more headaches. I learned Crystal Reports using an Enterprise version (which is very expensive) and having to work with this stripped down version is a nightmare.
I have completed a couple of different reports using Reporting Services and Stored Procedures and it is a walk in the park compared to doing the same thing using Crystal. Even if you don't know Reporting Services all that well, I'm sure you'll be fine. When I was stuck, I was able to find answers here on Stack Overflow. Any one of the Step by Step books are helpful as well.
I'm in need of a solution to print or export (pdf/doc) from C#. I want to be able to design a template with place holders, bind an object (or xml) to this template, and get out a finished document.
I'm not really sure if this is a reporting solution or not.
I also don't want to have to roll my own printing / graphics code -- I'd like all display concerns handled in a template.
I initially think of this as something Crystal Reports can do (although I've never used CR), but I'm not sure if I'm abusing the system here -- I'm not really interested in binding ADO.NET datasets at the moment (screw datasets). Can Crystal deal with binding to objects?
Does SSRS or WPF play in this field too?
A subset of WPF-P is XPS which can be used to present your objects via databinding.
One of the best choices if you are already using WPF.
Google Keywords: XPS, FixedDocument, FlowDocument, WPF Printing
Might read through this thread:
http://groups.google.com/group/nhusers/browse_thread/thread/e2c2b8f834ae7ea8
Seems a lot of people like iTextSharp
http://itextsharp.sourceforge.net/
For Word docs, look into Word's Mail Merge feature and Word automation. I did this recently in a form letter printing project. Basically what I did was create a Word template file (file extension .dot) and in this template file I defined MergeFields in a standard form letter. My application queries a database for the records it needs to print and then for each record it returns it matches fields in the database with these merge fields and sends the result (the merged doc) to the printer.
It's working really well and if I had a link that gave a definitive explanation, I'd provide it (check back here, I'll see if I can't find the most useful ones). Hopefully I've provided enough keywords to let you find your own resources. I can go into more detail if you need.
I've never had to export PDF files but for a project I'm working on now I'll have to. For a free solution my research has lead to iTextSharp (like Will Shaver points out) but I've only done the initial investigations and I have found a few pay solutions I might end up resorting to.
Well, heres my scenario.
Client/Server winforms application with SQL Express as the DB. I need to be able to print invoice, packing slips etc..
i would like the customer to be able to modify the invoices. ie. be able to put their logo or change font sizes etc...basically format the display.
Things i have considered so far are.
1) Use a template engine (similar to codesmith or mygeneration) and use templates that output HTML. Then print the html page.
2) Use ReportViewer in local mode. I've heard that users can download a plugin for web dev express and edit the local report files. can anyone confirm this?
3) Use Reportviewer in remote mode.
I don't have much experience with ReportViewer so I'm not sure if i should use local or remote mode as well.
Those of you that have done this kind of thing before whats your recommendation?
After just completing a project with it, I would heartily recommend iTextSharp to create your invoices and other forms as PDFs. In addition to creating PDFs from scratch, you can also use it to fill in PDF forms and/or templates created with Acrobat (or even MS Office/OpenOffice). And it's free.
It's pretty easy to use in Windows apps or in ASP.Net applications. Most of the documentation and the books on it (iText in Action, for example) are about the original Java version, iText. However, there are tutorials and example code on the conversion process and, for the most part, all of the functions and libraries work the same in the .Net version, so adapting the book and reference code has been no problem.
I definitely learned the hard way that HTML and CSS are great for browsers (well, great except for the "every browser interprets it different" problem), but horrible for trying to generate consistent, attractive, and precise printed output and forms.
I'm personally using Aspose Words: they use word documents as templates, and I'm using Words bookmarks function to mark and retrieve the fields I need to fill.
Aspose works nicely with Tables (ie: you can add lines to a table, etc...) and sees Word documents as XML documents. You can then save the document as MSWord or PDF.
I wouldn't say it's the greatest library in the world, but it's definitely worth having a look :)
you can use Crystal Report for this. But first you need to scan the INVOICE and save it as an image,
Next is, on your crystal report, export the image on to it, and DRAG the fields to where they must print on the invoice (IMAGE SERVES AS YOUR GUIDE). Then after everything has been set-up, DELETE THE IMAGE and try it.
hope this helps.