You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using microsoft.Interop for all my excel related application.
In one of my application, i just want to use Sort and Auto Filter of my protected Excel Sheet.
i think, sort and filter not possible in MS Interop through win c#.
So, i decided to use open source NPOI. below is my code and tell me how to use sort and filter of my protected excel sheet throug NPOI.
below is my win c# code
xlApp = new Excel.Application();
xlWb = xlApp.Workbooks.Open(path);
xlSht = (Excel.Worksheet)workbook.Sheets[ShtName];
//Not Working
xlWb.Worksheets[ShtName].Protection.IsProtected = true;
xlWb.Worksheets[ShtName].Protection.AllowSorting = true;
xlWb.Worksheets[ShtName].Protection.AllowFiltering = true;
//Not working
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using microsoft.Interop for all my excel related application.
In one of my application, i just want to use Sort and Auto Filter of my protected Excel Sheet.
i think, sort and filter not possible in MS Interop through win c#.
So, i decided to use open source NPOI. below is my code and tell me how to use sort and filter of my protected excel sheet throug NPOI.
below is my win c# code
xlApp = new Excel.Application();
xlWb = xlApp.Workbooks.Open(path);
xlSht = (Excel.Worksheet)workbook.Sheets[ShtName];
//Not Working
xlWb.Worksheets[ShtName].Protection.IsProtected = true;
xlWb.Worksheets[ShtName].Protection.AllowSorting = true;
xlWb.Worksheets[ShtName].Protection.AllowFiltering = true;
//Not working
xlWb.Worksheets[ShtName].Protect(XLwbpwd);
xlWb.Save();
xlWb.Close();
xlApp.Quit();
Beta Was this translation helpful? Give feedback.
All reactions