Bar Charts from multiple columns in Excel using C# .NET - c#

I have an excel sheet with bulk of data( several columns and thousands of rows). However, I would like to express the data in barcharts. I had found a method which gives cell numbers in the code like A1:B2, A3:C3, etc. But the problem is the excel sheet consists of thousands of rows and several columns. So, I can't give manually. Can anyone suggest a relevant method for this?

Related

how to fill xlsx template whith dynamic data to generate chart by NPOI?

I have a .xlsx file which contain a chart as a report template. I create a table manually as the data source of the chart. What I want to do is to fill the table with data so that the chart I inserted will change respectively, the data is dynamic.
The problem I met is the same as the link below:
"The new row we just added wasn’t included in the table. The chart that is linked to the table won’t update because it isn’t aware of the new row".
(https://www.leniel.net/2009/10/npoi-with-excel-table-and-dynamic-chart.html)
image that show the problem
The solution in this website is to extend table manually in excel app.I have thousands of data row to insert so the solution is not suitable for me.
Is there any methods to extend table by code?

How can I create a WPF data grid with an enhanced table header?

I'm currently working on a WPF based data management system, which is planned to replace the old Excel based one. This old system is mainly consist of tables where the user can input his data. One of these tables looks like this:
The number of rows and columns are fixed (25 rows per day, from 6AM to 6AM the next day).
It is kinda difficult to provide an input form for this kind of data, so I tried implementing the table in WPF using a DataGrid. However, I wasn't able to get these nifty merged cells, especially in the first and second row.
Are there any 'DataGrid' usercontrols on the market that allow merging cells, shading rows etc.? Or is there any other way of providing an user-friendly input form that I've overlooked?
If you're looking for Grid cell merging tool you can try Devexpress.
Here is a link on how to merge DataGrid cells using Devexpress
Another solution to merge DataGrid Rows is to use a ListBox

DataTable columns inside columns or merged row table structure

I've had a Google but I find no answer. You know how say in MS Word, when you insert a table, you can merge the columns of one single row to create a column-less row? Or have say a main header and then more columns inside it? Like so:
Merged Row:
|Column 1|Column 2|Column 3|
|Value|Value|Value|
|Merged Row|
|Value|Value|Value|
God the text formatting is awful on this web-site...and the Header Column example:
|Main Header||Another Main Header|
|Column 1|Column2||Column1|Column2|
I'm trying to achieve this in a written DataTable in C# which is being populated by an array. But I'm interested in changing its structure as one of the above, whichever is possible/easier.
So I've created my DataTable and added normal columns and rows etc. But I'd like to create either a merged row or a main header to display. Instead of having a repeated value in a single column for the values I am getting.
Can someone please provide a quick example on how I could achieve either one of those? Because repeated value will just look ugly.
Cheers.
You're talking about displaying data in a particular way but a
DataTable has nothing to do with display. It is for storage and that's
that. How you display the data is up to you. The same data can be
displayed in innumerable different ways. In a WinForms app, one of the
most common ways to display the contents of a DataTable is with a
DataGridView. You can choose which columns to display and merge cells
in that grid if desired. In short, you're looking in the wrong place
to do what you want to do. It is a presentation issue, not a data
issue. –
jmcilhinney

Exporting a ListView to Excel

I have a ListView that I need to export to an Excel spread sheet. There a bunch of documentation to export GridViews and to a lesser extent ListViews to Excel but not so much in terms of doing some customization before export.
Before exporting I need to prep the data, as a) only a subset of the columns need to be exported b) some of these columns are editable textbox controls.
Doing a simple export without preping the table means that the control gets exported as well which obviously looks really ugly.
At the moment I can iterate the controls and remove the formatting from both the Grid and ListViews thus solving b.
In the GridView and I can just set some the columns I want to hide using Visible = false; and then set back to true when I have finished.
The thing I can't figure is how to do this with the listview.
I am wondering what is the best way to do this as I am kind of stuck.
Thanks,
Michael
I actually think this is a dumb question. If I want to export the list view to excel then i'll export all columns removing the unnecessary formatting. Then users can do any customization of the columns in Excel.
To do any customization of the data prior to export then I should use the underlying data types.
The above approach (admittedly my own) is simply bad.

Export to excel issue

I have a asp.net page in which i am exporting gridview records to the excel files. But in some records only ############# is displayed in the excel file & when i view that record in function bar of the excel i am able to view correct record. So what can be the problem?
Waiting for your reply.Thanks a lot in advance.
Thanks
Mehul Thakkar
Make the columns wide enough so that the entire number can be displayed.
####### in the cell only means that the cell is too narrow to fit the value (for some data types). If you make it wider the problem will disappear.

Categories

Resources