This project is read-only.

How to add empty row in Excel combobox using NPOI

Mar 20, 2015 at 9:11 PM
Edited Mar 20, 2015 at 9:19 PM
Hello all
First i'm sorry about my bad english, but i hope you will help me
Second, i have a trouble...
use NPOI latest version for C# net 2.0
HSSFWorkbook xssfwb;

//open file
                    using (FileStream file = new FileStream(@"C:\SomeFolder\test.xls", FileMode.Open, FileAccess.Read))
                        xssfwb = new HSSFWorkbook(file);

                    HSSFSheet my_sheet = (HSSFSheet)xssfwb.GetSheetAt(0);
                    
                    HSSFFormulaEvaluator evaluator = (HSSFFormulaEvaluator)xssfwb.GetCreationHelper().CreateFormulaEvaluator();
                    
                    HSSFRow mainRow = (HSSFRow)my_sheet.GetRow(1);
                    // Header Row
                    for (int i = 1; i < dt.Rows.Count; i++)
                    {
                        HSSFRow my_sheetRow = (HSSFRow)my_sheet.CopyRow(1, i + 1);
                        my_sheetRow.Height = 1350;
                        
                        CellRangeAddressList addressList = new CellRangeAddressList(i + 1, i + 1, 6, 6);
                        DVConstraint dvConstraint = DVConstraint.CreateExplicitListConstraint(new String[] { string.Empty, "In quuee", "Informed", "Busy", "Not answered", "Incorrect contact" });
                        HSSFDataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                        my_sheet.AddValidationData(dataValidation);
                 }
then I save file and open it
I don't see empty value in combobox, I just see this

"In quuee",
"Informed",
"Busy",
"Not answered",
"Incorrect contact"

I need this in combobox in cell

"",
"In quuee",
"Informed",
"Busy",
"Not answered",
"Incorrect contact"

what I'm doing wrong? Please help.