Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TableNode 3 columns vertical text (Read 1320 times)
ZoomTool Company
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Nov 2nd, 2014
TableNode 3 columns vertical text
Nov 2nd, 2014 at 1:14pm
Print Post  
Hi

I would like to have table node that has 3 columns - the first two columns group the rows in third column. I.e. More like group reporting. First two columns should span multiple rows. And to save space first two columns text content is virtical while the 3 column rows are horizontal.

In short, if a column's text value repeats multiple rows then we should be able to group the columns into one cell spanning multiple rows and display it as vertical running text.

Is there a way to do this? That you in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TableNode 3 columns vertical text
Reply #1 - Nov 3rd, 2014 at 8:43am
Print Post  
Hi,

There is no built-in support for grouping. You can specify how many rows should be spanned by a cell by setting its RowSpan property, so you could implement that yourself using this method:

Code
Select All
void MergeCells(TableNode table, int column)
{
	int startIndex = 0;
	while (startIndex < table.Rows.Count)
	{
		int span = 1;
		while (startIndex + span  < table.Rows.Count &&
			table[column, startIndex].Text == table[column, startIndex + span].Text)
		{
			span++;
		}
		if (span > 1)
		{
			table[column, startIndex].RowSpan = span;
			table[column, startIndex].TextFormat.FormatFlags =
				StringFormatFlags.DirectionVertical;
		}
		startIndex += span;
	}
}

var t = diagram.Factory.CreateTableNode(10, 10, 30, 100, 3, 20);
t[0, 0].Text = "test 1";
t[0, 1].Text = "test 2";
t[0, 2].Text = "test 2";
t[0, 3].Text = "test 2";
t[0, 4].Text = "test 3";
t[0, 5].Text = "test 4";
t[0, 6].Text = "test 4";
t[0, 7].Text = "test 5";
MergeCells(t, 0); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint