Tag Archives: validation

Exception from HRESULT: 0x800A03EC when adding data validation

Questions: int row_index = 2; foreach (DataRow row in dataTableSourceSystem.Rows) { xlWorkSheet.get_Range(“AM” + row_index.ToString(), System.Reflection.Missing.Value).Value2 = row[“LookupShortName”].ToString(); row_index++; } Range range = xlWorkSheet.get_Range(“G2,G50”); range.Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertStop, XlFormatConditionOperator.xlBetween, “=$AM2:$AM50”, System.Reflection.Missing.Value); The last line is throwing an exception 0x800A03EC Am2 to Am50 has values. Can anyone please help? Answers: It should be Range range = xlWorkSheet.get_Range(“G2:G50”); You have… Read More »

“Copy-Paste” data validation from different source in Apache POI Excel

Questions: I have created an excel file with dropdown using Apache POI. The below is the code: { row.createCell(i).setCellValue(col[i]); //i — loop counter CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, i, i); DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint( new String[]{“10”, “20”, “30”}); DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint); dataValidation.setSuppressDropDownArrow(false); sheet.addValidationData(dataValidation); } This code does the validation of the… Read More »

Excel Copy and Paste while mantaining data validation

Questions: When I perform a copy and paste from a blank cell to a cell with data and validation, the validation in the destination cell itself gets deleted. Is there anyway I could maintain the validation in the destination cell while only pasting the values? (And validating the contents that are pasted) (Also, and hence… Read More »