Hi,
How to hide or delete columns from Project File i.e., mpp file and save.
I tried with below code, its not working for me,
project.DefaultView.Table.TableFields.Remove(new TableField { Field = Field.TaskResourceNames });
project.Save(@“C:\Ramya\MPP\New\SDM_NewMPP_WithSampleData.mpp”, new MPPSaveOptions { WriteViewData = true });
Please provide me the resolution.
@ramyaakula,
Can you please share source file so that we may further investigate to help you out.
@Adnan.Ahmad
Above already I provided my source code,
Project project = new Projecr(@“C:\Ramya\MPP\Old\blanksdmtemplatea.mpp”)
project.DefaultView.Table.TableFields.Remove(new TableField { Field = Field.TaskResourceNames });
project.Save(@“C:\Ramya\MPP\New\SDM_NewMPP_WithSampleData.mpp”, new MPPSaveOptions { WriteViewData = true });
@ramyaakula,
Can you please share source mpp file which you are using on your end so that i may work on that to help you out.
@Adnan.Ahmad,
PFA my source empty mpp file.
From attached file i need to remove “Resource Names” column.
BlankTemplate.zip (25.4 KB)
@Adnan.Ahmad,
I got the solution, i can able to reove column using below code,
project.DefaultView.Table.TableFields.RemoveAt(8);
1 Like
@ramyaakula,
Its good know to you that have resolved your issue.
How to get the list of hidden columns ?
Can anyone help in that
@mitbilal,
there is no definition of “hidden” columns.
Fields contained in project.DefaultView.Table.TableFields are visible.
Fields not contained in project.DefaultView.Table.TableFields can be considered as “hidden”.
@vasiliysinitsyn so there is no direct way to get the list of hidden columns from MS Project file like we have project.DefaultView.Table.TableFields ?
As mentioned: Fields not contained in project.DefaultView.Table.TableFields can be considered as “hidden”.
From where we can get the complete list of fields which include hidden and visible as well ?
@mitbilal,
you can find all allowed fields in Aspose.Tasks.Field enumeration.
1 Like