Hi,
I want to remove columns from program sub-file using Smart office script.
I tried to find a function to remove column but no luck.
Has any one encountered similar scenario ?
Thanks,
Jags
The below should be the solution:
Loop through the Listview and Copy existing Rows with the Columns you like to keep over to a 'NEW Array'.Then you delete the existing Rows and after this add the Rows from the 'NEW Array' that is missing the Column(s) you like to exclude.
Hi Rene,
Thanks for your inputs.
Do you know how to copy only specific column?
any sample code would be helpful
Thanks & Regards,
I have no way of testing this right now, since I'm running H5, not Smart Office, but the below should work:
listView = controller.PanelState.ListControl.ListView; listControl = controller.RenderEngine.ListControl; gridView = listView.View;
var toRow = listView.Items.Count - 1; var columnCount = gridView.Columns.Count;
var rows = IList(listView.ItemsSource); for (var i = 0; i <= toRow; i++) { var row = rows[i];
if (row.Items.Length < columnCount) { //Only do if Column is not previously filled!
var oldArray = row.Items; var newArray = new String[oldArray.length - 1]; //oldArray.CopyTo(newArray, 0); //Copy Sub-File as it is var f = 0; for (var c = 0; c <= columnCount-1; c++) { newArray[c] = oldArray[f]; if(c==5) f++; //Skip Column 6 f++; } row.Items = newArray; rows.RemoveAt(i); rows.Insert(i, row); } }