Create crystal report with crostab object through code file - c#

Am new to crystal report and this stackoverflow. with the lot of hope am writing this to get help. It will be encouraging if you provide support.
I want to convert Power builder library(.pbl) files to crystal report files(.rpt) .
In that process, i need to integrate all the objects available/supported in crystal report .
Now am in the process of converting Crosstab objects.
So, How can i provide the necessary bound values (like rows,colums,summary) for crosstabobject to form crosstab in crystal report.
For this i need to mention all the specifications in my code(.cs) file . i need the code for "Crosstabobject" implementaion.
If anyone could help on this, I will be very thankful to you
Thanks in advance,

The RAS (report-application server) SDK offer the most functionality when it comes to modifying a RPT--much more than the Crystal Reports SDK. The in-process version of the SDK no supports doing the modification on the client.
It appears, however, that the SDK doesn't offer the functionality to create/modify a cross-tab object, only to delete it. Supporting documentation from the Java-edition of the RAS SDK.
** edit **
This appears to be the case in the .Net SDK as well. Here's a link to the Report Application Server .NET SDK in CHM format.

Related

Asp.net webform to pdf

I have a simple asp.net registration form where users fill out the information to register. I have it captured in an oracle database.
Is there a way i can generate a pdf from the data in the database and show it like a actual pdf form?
I looked at itextsharp and it has some licensing restrictions. What are some of the other free solutions that stackoverflow users has used that will help my problem?
Thanks
itextsharp is free to use for non-commercial development, but if you use for commercial development then you either need to obtain a license or make your code available under the GPL license.
Here are some alternatives to itextsharp:
PDFSharp is a free option, however its latest release is from 2009.
There is an open-source version of PDFjet.
PDF Clown
You can get the form with contents as PDF, by using the service pdfmyform.com - this is a commercial service that lets you convert the whole webpage including form contents in one go to a PDF, without any development. There's a free plan for limited use.

How to generate report in word 2010 using c# , dot net, word templates, xml [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
We have a database application that stores data that we want to report in Microsoft Word.
Suppose all information of my customers is stored on a database system and I am now requested to create hundreds of word letters, reports that will be sent to my customers. These letters have the same content but different customer name, customer address, etc.
I want to make use of Office Word 2010 by creating document template with content controls using c# and .Net, sql as database to replace the content of this template.
I've been looking for articles on automating Word 2010 in C# and dot net and sql. Could someone give me a push in the right direction?
You can use Interop.Word in your program, but keep in mind that the available documentation is very scarce. I managed to develop my application looking at examples like this one from C-SharpCorner or this one from WindowsDevCenter. Even if the examples are old, you can get the main idea and get familiar with the syntax, and write your program afterwards with an updated version of Interop.Word (which has a slightly simpler syntax).
In your case, you should create a neat Word template, with bookmarks located in the places of your document where you will insert the customer information. Then you can open the template from your program and navigate it using those bookmarks, as you insert the information retrieved from your database.
There are other interesting alternatives to Interop.Word that you could try if you don't want to go too deep into Word automation, such as DocX (which doesn't even require Microsoft Word or Office to be installed) or Open XML (to generate .docx files).
I've used the Office.Interop assemblies in the past for this kind of functionality but this method carries a few distinct disadvantages:
Word must be installed on the machine where the code is running
The Interop assemblies actually start up Word in the background, so you have to be careful to dispose of everything properly and handle errors, otherwise you'll end up with Word processes wasting CPU/Memory on the host server
The APIs are not very pleasant to work with and documentation is somewhat scarce
I've also played with DocX and Open XML, both of which have their merits but tend to be slightly limited by comparison with Interop. My advice would be to attempt the functionality using DocX or Open XML and only fall back to Interop if you can't achieve the functionality any other way. There should be plenty of tutorials online for all three APIs.
Microsoft recommends OpenXml for any application running in a server process, and this approach would probably be one of the best for reducing dependencies (as others have mentioned). Here are some links to get you started:
Download OpenXml SDK 2.0: http://www.microsoft.com/en-au/download/details.aspx?id=5124
Useful Tutorials: http://msdn.microsoft.com/en-us/library/ff478255.aspx
So for start DO NOT USE INTEROP, i've been using it for the last 4 years, and i have to tell u it's not a good idea (it's really lost, and u'll hit lots of problems. It's actually written on Microsoft's site that you shouldn't use it for server side generation.
You should use the OpenXML SDK, i've actually just started using it but i have to say that even if it seems a bit harder to use, it's definetly a lot faster that using interop and the best thing is that know i don't need any programs from the Office suite to be installed on my pc, the downside is that i can't export to PDF or XPS anymore without a 3rd party library
You can find the sdk here
http://www.microsoft.com/en-us/download/details.aspx?id=30425
I suggest downloading the tool as well it's pretty useful.
This is a good tutorial to start with it really helped me a lot.
http://msdn.microsoft.com/en-us/library/office/bb448854.aspx
And u can also use the API documentation from the Productivity Tool which is on the same site as the sdk
I agree with others that the OpenXML SDK is a good way to go for the same reasons. I am in the midst of creating a similar kind of report generation as you are. The reports I need to generate unfortunately are very dynamic not only with data but with the layout.
If your layout does not need to change then I would strongly suggest using the SDK Tool, it lets you take any word document and generate the c# code for you to recreate the same exact doc. From that point all you have to do is replace the text with the data you want in the code.
You could make a generic report in word, get the code with the tool, then just do a search for the placeholder text in the code and replace that string with a variable. its as easy as text1.text = reportData;
I also find the SDK Tool a great way to learn the code, you can compare two files side by side and see how they differ in the code.
Your answer is OpenXML SDK.
goto Open XML SDK 2.5 for Microsoft Office
download OpenXMLSDKV25 and OpenXMLSDKToolV25
install sdk and productivity tool
open word and create your template document
open Open XML SDK Productivity Tool
open word document
right click on document name from Document Explorer and select reflect code
copy all generated code to your project
find and edit "Paragraph" or "Run" that you want replace with your data
I have used both interop and syncfusion to create reports (although I was generating an excel report but both technologies can be used to generate word reports also). My feedback :-
Although interop is included in most computers which have visual studio (not sure about non visual studio computers), usage of interop requires the presence of compatible microsoft excel also on the computer generating the report whereas syncfusion does not requires the presence of microsoft excel on the same computer.
If you plan to use asp.net, then interop is not supported (atleast it was not when I worked) whereas syncfusion is supported.
Link for syncfusion :-
http://www.syncfusion.com/products/aspnet/docio
Summary :- If you are developing a console application and server(where the application will be deployed) has microsoft office installed, then interop might be a good idea. Otherwise, you can have a look at syncfusion also.
You can usee Free .NET Word API to generate report in word 97 ~ 2010 using c#.
//Create word document
Document document = new Document();
document.LoadFromFile(#"..\..\..\..\..\..\Data\Fax.doc");
string[] filedNames = new string[]{"Contact Name","Fax","Date"};
string[] filedValues = new string[]{"John Smith","+1 (69) 123456",System.DateTime.Now.Date.ToString()};
document.MailMerge.Execute(filedNames, filedValues);
//Save doc file.
document.SaveToFile("Sample.doc", FileFormat.Doc);

Exporting Listview in Visual Studio Into Microsoft Excel

I am new in creating Report System using Visual Stuido 2010 C#. I already have a listview in my forms where it has all the information needed for the report. I am planning to integrate it with Microsoft Excel. What I want is that the user is capable of exporting the reports in the listview into Microsoft Excel. Is there anything I can read or research on how to do this? Or is it even possible? Please help. Thanks.
see:
http://www.dotnetlogix.com/article/aspnet/56/How-to-export-listview-in-excel-in-asp.net.html
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/ExportASPNetDataGridToExcel11222005041447AM/ExportASPNetDataGridToExcel.aspx
Iterate the data source and write values into CSV (comma separated) file. I think this will be the simplest way. (Must read article : Why are the Microsoft Office file formats so complicated? (And some workarounds) by Joel Spolsky).

Reporting tool(facility) with small size

I am using .net with c#. If there is a requirement of giving facility of reporting. Report will be for chart. And report will be for information coming from datatable which will be created manually.
I tried with crystal report and it was done completely. But when user will download the full application, framework 2.0 will be installed and it is ok, but if we use crystal report then in the client machine whole crystal report will be installed in client machine what I don't want because it is with more size.So requirement for reporting is only for giving report for chart and for printing data for datatable.
Then what are other alternatives for crystal report which with my requirements can be satisfied and most important thing is size of that report facility should be as possible as small. Or if there is a reporting facility when we use it we have to just import the dll then that dlls should be of small size.So what are reporting tool which comes with as possible as small size ?
For WPF / Silverlight / Windows Phone 7 I highly recommend Visifire : http://www.visifire.com/
You can also view the source code :) I would hate distributing something I do not have the source code for in case I need it :)
Fast report is the answer. It can be easy to make report with fast report. We have to just register the datatable and we can make report. The link is fast-report.com.

Can Crystal Reports be edited in a .Net Windows interface?

I am currently evaluating Crystal Reports 2008 for use within a major enterprise project. I have successfully used Crystal Reports Basic within Visual Studio, but we want more functionality. Can these reports be edited in a .Net Windows interface?
Reports will be produced based on ADO.NET Xml datasets and will be saved to a SQL Server db as blobs of the rpt files. We will be retrieving these rpt files for viewing within a .Net Windows application coded using Visual Studio 2008 in C#.
I need to produce letters that hide and show sections/paragraphs based on formulae, but the users want to be able to edit the text.
Once a report has been created and is being displayed within the .Net CrystalReportViewer control (inside a .Net Windows application), is there any way I could permit the user to alter the displayed text and re-save the rpt file?
I know that I can use parameters, but it's not ideal for large paragraphs of text which may include some words in bold for example. The users are only likely to be changing a few words, such as the addressee of the letter. They have insisted that they need to be able to change anything on the letter.
I also know that (with Crystal XI or 2008) I can export to EditableRTF which does not put the text in frames like the standard RichTextFormat export option. The .Net RichTextBox component does not show headers or footers, which is a pain. I can show the RTFs in Word (even though they miss out lines and boxes from the report, but that's another matter) but quite frankly I'm terrified of the stories of deploying Office interop components in .Net apps.
When Crystal displays a report in preview mode you can click on pararaphs and it knows that there is a 'field' there because it highlights the row(s) with a box. Is there any way we can just edit this text and save the report again?
I'm under pressure to produce an estimate for this area of work. Is it possible within Crystal?
You've got a really good handle on the capabilities of Crystal, and you're right - the idea of editing big chunks of report text "live" is going to be tough.
The "export to RTF" option might be workable, provided you can live with one-way generation (after you use Crystal to generate the report and start editing the output, you can't re-generate without losing your edits).
Have you considered something like OneNote or other XSLT-based solutions? It seems like your users want a lot of control over the generated output, so your design's going to have to factor that in. Maybe even generate output and then shoot it straight into a document management system so users' changes are tracked and controlled?

Categories

Resources