Is the Microsoft Excel drop-down list gone after saving?

Sheet.get_Range( "D2", string.Format("D{0}", MAX_ROWS)).Validation .Add(E.XlDVType.xlValidateList, Type.Missing, E.XlFormatConditionOperator.xlBetween, string.Join(",", CountryCollection.Select(x=>x.CountryName.Replace(",",")).ToArray())); 

The above code will help generate a drop-down list in a newly opened excel file, but as soon as the user saves the sheet, the drop-down list will disappear. The changes made by the user will remain there, but the drop-down list will disappear. Any idea?

UPDATE:

Currently suspecting the reason the dropdown is gone is explained by the following code

 void WB_BeforeSave(bool SaveAsUI, ref bool Cancel) { workSheet.get_Range(START_CELL, string.Format(END_CELL, MAX_ROWS)).Validation.Delete(); } 

I tried to comment on the above code so that the validation is not deleted, however, when I try to open the excel sheet manually, Microsoft Excel detects that it is checking for unreadable content and automatically deletes it.

+6
source share
1 answer

Try to save excel in .xlsx format, some actions will not take effect if the correct file format is not selected.

0
source

All Articles