Is it possible to display master-child rows in Excel using C#?
For example, the first row has two children, so there will be a plus sign. When the user clicks it, the children are displayed.
Yes, you can do this with Pivot Tables. http://office.microsoft.com/en-us/excel-help/expand-collapse-or-show-details-in-a-pivottable-or-pivotchart-report-HP010175905.aspx
Related
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
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
I am very new to syncfusion and I am kind of stuck with this problem. I can easily populate a table if all of the rows and cells are created but I run into 'IndexOutofBounds' error once my data exceeds the number of rows in my template table. How can I add a row to a growing template table using Syncfusion in C#? I also would like to know how to handle the possiblity of the table growing to more than one page.
Adding a row is an easy task. After adding the row the cell paragraphs have to be added and formatted. That was the error I was running into.
IWTable table = new IWTable();
table.AddRow(True);
table.Rows[0].Cells[0].AddParagraph().AddText("sample text");
If you know the exact number of rows and columns, then you can utilize the below code to define rows and columns for a table.
IWTable table = document.LastSection.AddTable();
table.ResetCells(10, 4);
If you are not sure about the number of rows then you can use the below code to add a row dynamically.
table.AddRow();
I have a rdlc where I'm building a report.
I'm using a tablix grouping by a field of the tablix dataset, like the following:
When I fill the report with data and refresh it, it comes out like this:
Now, I want the first column(wich has the group by by the field "nome_terr") appear not in first place, but by second. The first column has to be "territorio_emp". If it was a normal column, I'd just move it, but being the Group By column I don't know how to do this.
Ideas?
Thank you.
If you know that your Territorio_Emp data is 1-1 related to your Nome_Terr column, you can just group by Territorio_Emp first, then by the Nome_Terr column.
If thats not possible, you can keep it the way it is, but make the width of the group by column 0, so its basically hidden. Just drag the column header separators.
http://bytes.com/attachments/attachment/2155d1251048605/db_preview.jpg
According to the above image.
How can i Show the table (Preview) in datagridview.
You can use nested grid views, there are number of methods to do that. Google "nested gridviews"
You can create the 2nd table, with the sport and game id only and the players cells empty, and manually insert the players in the last column, by creating another 3-row table inside each players cell.