Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: How to add empty row in Excel combobox using NPOI

$
0
0
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 when i open it, i don't see empty value in combobox
I need this in combobox in cell

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

what I'm doing wrong? Please help.

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>