Print the columns of a DataGrid in individual blocks
-
Hi I want to print the data of the DataGridView by splitting the columns. That is each column of the DataGridView should split and should be displayed in individual tables on a form or Print view. For example the Print view of a DataGridView should look like this # # # # # # # # # Note: Here each # represents the table of a column of the table. Here the number of rows and columns will change, so preferably the number of column's tables should change dynamically. If any one know the solution Please kindly send me. Thanking you
-
Hi I want to print the data of the DataGridView by splitting the columns. That is each column of the DataGridView should split and should be displayed in individual tables on a form or Print view. For example the Print view of a DataGridView should look like this # # # # # # # # # Note: Here each # represents the table of a column of the table. Here the number of rows and columns will change, so preferably the number of column's tables should change dynamically. If any one know the solution Please kindly send me. Thanking you
-
I would recommend using CrystalReports. But in order to help you more you need to try and draw us a clearer picture of what is your plan... If you can, post a print screen of your desired final result and we'll see how it goes from there.
Thank you for your reply If we have a table like this Customer Details: Customer Name E-Mail Phone Job Date John John@gmail.com 34567 Code 31-01-09 Mary Mary@hotmail.com 67890 Design 01-02-09 Swetha Swetha@live.com 87654 Testing 02-02-09 then the Print View of this should look like this. Customer Name E-mail John John@gmail.com Mary Mary@hotmail.com Swetha Swetha@live.com Phone Job 34567 Code 69890 Design 87654 Testing Dates 31-01-09 01-02-09 02-02-09 i.e., each column of the Customaer Details Table should be displayed in a separate individual tables. ex:if the table have 10 columns then in Printview 10 invividual tables for these columns chould be displayed. How to display it dynamically in a windows form.Note that the number of columns and rows will vary dynamically
-
Thank you for your reply If we have a table like this Customer Details: Customer Name E-Mail Phone Job Date John John@gmail.com 34567 Code 31-01-09 Mary Mary@hotmail.com 67890 Design 01-02-09 Swetha Swetha@live.com 87654 Testing 02-02-09 then the Print View of this should look like this. Customer Name E-mail John John@gmail.com Mary Mary@hotmail.com Swetha Swetha@live.com Phone Job 34567 Code 69890 Design 87654 Testing Dates 31-01-09 01-02-09 02-02-09 i.e., each column of the Customaer Details Table should be displayed in a separate individual tables. ex:if the table have 10 columns then in Printview 10 invividual tables for these columns chould be displayed. How to display it dynamically in a windows form.Note that the number of columns and rows will vary dynamically
OK, it's actualy very easy thing to do. The main idea is to use the subreports option in the crystalreport item. You need to add a new DataSet item to your project (Add new item -> c# -> DataSet) In this new dataset add new datatable and add rows according to your original table (i.e. Name, Email, and etc.) This DataSet will not be used to host the data, rether this will only be used to set as a Template for your report. You add a CrystalReport item to your project (Add new item -> Reports -> CrystalReport) In the wizard just choose standard and finish the wizard after doing so. Now you should have a blank report with 5 sections. Right click the the white blank area in between "Section 3 (Details)" to "Section 4 (Report Footer)" and choose insert -> subreport. In the dialog the opens up choose "Create a subreport with Report Wizard". Name the report with the title of what you wish to display (i.e. Name) and click on "Report Wizard..." A new dialog name "Standard Report..." should opens up. Expand Project data -> Ado.NET DataSets -> YOURDATASETNAME and by clicking the double arrows to the right of this treeview add your datatable to this report. after doing so click next. now add only the field you wish to display on this table (i.e. Name). Click Next and now you can either finish or click next to the end. Up until now you have created the first section wich will show only the names! In order to show other columns, one under the other, you need to add more sections. Right click the Gray Title named "Section 3 (Details)" and choose insert section below. Now do the same to add subreport with your desired column. keep adding sections for each column you wish to display. In order to display your report you need to do three things. Add a CrystalReportViewer object to a Form. By using the code, Attach your data to the report and the report to the viewer.
//YourDataSet is a DataSet object which should contain all your data from any datasource you have
//You can create and simulate a dataset if you wish just to try the report. try searching online for how to do so.YourCrystalReport objReport = new YourCrystalReport(); //Creating the report object objReport.SetDataSource(YourDataSet); //Binding your data to the report TheCrystalReportViewerObject.ReportSource = objReport;
good luck...
-
Hi I want to print the data of the DataGridView by splitting the columns. That is each column of the DataGridView should split and should be displayed in individual tables on a form or Print view. For example the Print view of a DataGridView should look like this # # # # # # # # # Note: Here each # represents the table of a column of the table. Here the number of rows and columns will change, so preferably the number of column's tables should change dynamically. If any one know the solution Please kindly send me. Thanking you