Hi cyantist,
I found a very simple way to do it, in case you want to distribute
the columns in new created worksheets.
I think its not the best way to do this, but searching in a rush I didnt find a better
way yet.
void distribute_columns_ex()
{
WorksheetPage wpMain;
Worksheet wksMain, wks1, wks2, wks3;
// main Worksheet must be activated
wpMain = Project.Pages(); // --> activatetd book
wksMain = wpMain.Layers(); // --> activated sheet
// create new worksheets and delete needless columns
wks1.CreateCopy(wksMain);
wks1.DeleteCol(2); // after deleting column with index 2 (third column)
wks1.DeleteCol(2); // the next columns update there index
wks1.DeleteCol(2);
wks1.DeleteCol(2);
wks2.CreateCopy(wksMain);
wks2.DeleteCol(1);
wks2.DeleteCol(2);
wks2.DeleteCol(2);
wks2.DeleteCol(3);
wks3.CreateCopy(wksMain);
wks3.DeleteCol(1);
wks3.DeleteCol(1);
wks3.DeleteCol(3);
wks3.DeleteCol(3);
}
I tested this with a Workbook with one Worksheet, which had 7 columns.
First column was X-designated holding row index. The other 6 columns had sample data
random numbers).
So if you just want do distribute the columns of a Worksheet into new created ones,
this shows a very simple way. Probably its not the nicest one, but who cares...? ;D
But if you want to distribute the columns to existing Worksheet, you cant do it
like that.
I searched for a way to just add a Column object to an existing Worksheet. So
that you could do something like this:
{
...
Column col;
col.Attach( wksMain.GetName(), index );
wks1.AddCol( col ); // this is not supported, but would be nice...
...
}
When I find a better way to do things like that, I will let you know.
|-- TreeNode
...|-- a??
...|-- ha!!