Error in Adding values in drop down list of Excel using Apache POI?

Up vote 1 down vote favorite share g+ share fb share tw.

I have this code: CellRangeAddressList addressListTax = new CellRangeAddressList(rowCount, rowCount, labelRowCnt, labelRowCnt); DVConstraint dvConstraintTax = DVConstraint. CreateExplicitListConstraint(new String { "I0-Input Tax 0%", "I1-Input Tax 10% ", "I2-Input Tax 12%","IE-Input Tax Exempt", "J0-0% Input Tax,China ","J11/08/03 13:36:583% Input Tax,China ","J11/08/03 13:36:583% Input Tax,China ", "J3-6% Input Tax,China","J4-4% Input Tax,China ","J5-3% Input Tax,China", "J6-7% Input Tax,China", "L1-5% Luxury Tax,China ", "O0-Zero-rated Sales ", "O1-Output Tax 10% ","O2-Output Tax 12% ","OE-Output Tax Exempt ", "P0-Purchase Tax 0% ","P1-Tax on Purchase 0%","P2-Tax on Purchases 5% ", "P3-Tax on Purchases 7%", "P4-Out of Scope purchase 0% ", "P5-Imported Purchase 0% ", "S0-Exempted Tax on Sales ","S1-Tax on Sales 0% ","S2-Tax on Sales 5% ", "S3-7% GST ","S3-Tax on Sales 7%","X0-0% Output Tax,China ","X0-China Output Tax 0%", "X11/08/03 13:36:583% Output Tax,China","X11/08/03 13:36:583% Output Tax,China" }); HSSFDataValidation dataValidationTax = new HSSFDataValidation(addressListTax,dvConstraintTax); dataValidationTax. SetSuppressDropDownArrow(false); sheet.

AddValidationData(dataValidationTax); This throw error in Linux: java.lang. IllegalArgumentException: String literals in formulas can't be bigger than 255 characters ASCII 11/08/03 13:36:58 java.lang. IllegalArgumentException: String literals in formulas can't be bigger than 255 characters ASCII 11/08/03 13:36:58 at myorg.apache.poi.hssf.record.formula.StringPtg.(StringPtg.

Java:65) 11/08/03 13:36:58 at myorg.apache.poi.hssf.usermodel.DVConstraint. CreateListFormula(DVConstraint. Java:413) 11/08/03 13:36:58 at myorg.apache.poi.hssf.usermodel.DVConstraint.

CreateFormulas(DVConstraint. Java:386) 11/08/03 13:36:58 at myorg.apache.poi.hssf.usermodel. HSSFDataValidation.

CreateDVRecord(HSSFDataValidation. Java:197) 11/08/03 13:36:58 at myorg.apache.poi.hssf.usermodel.HSSFSheet. AddValidationData(HSSFSheet.

Java:378) 11/08/03 13:36:58 at com.DemoPxExcel. DoAction(DemoPxExcel. Java:217) 11/08/03 13:36:58 at com.ListRFQ.

DoAction(ListRFQ. Java:198) java apache-poi link|improve this question edited 11/08/03 13:36:583 at 19:30Danilo Piazzalunga1,659615 asked 11/08/03 13:36:583 at 12:13Raj387 11% accept rate.

This is exactly as the error says. The String representation of the formula you are using in dvConstraintTax is greater than 255 characters and this is not supported in POI.

I will assume you're actually looking for a solution to your issue, rather than having the obvious stated to you... The workaround I figured out was to add the list of constrained items to a secondary sheet, protect the sheet, then refer to the range to pull the items: See the documentation on "Creating Data Validations From Spreadsheet Cells" at poi.apache.org/spreadsheet/quick-guide.html I did this solution, added my list to a secondary sheet, then protected the sheet. Not sure what the limitation in Excel verions of pull-down size/items is, but it worked with a list size/content similar to yours. Worked fine with poi3.7.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions