Xssfdatavalidationhelper.createdateconstraint has a bug

Source: Internet
Author: User
Tags trim vmin

Note: XSSF Datavalidationhelper, also known as: Xssfdatavalidationconstraint (4, Operatortype, Formula1, FORMULA2) There is bug,hssf* no problem, POI 3.8-poi3.12 have tried, all have this problem

	/** * Set ExcelSheet data fill validity constraint * @param sheet current sheet * @param validationtype Authentication type * @param operatortype operator * @pa Ram RowIndex Row index * @param colindex column index * @param vMin min * @param vMax max * @param errortitle Error tip title * @param ERRORMSG error message */public static void Setdatavalidationcheck (Sheet Sheet, int validationtype, int operatortype, int RowIndex, int colindex, string vMin, String VMax, String errortitle, String errormsg) {if (Null==sheet | | rowindex<0 ||
		Colindex <0) {return; }//Two values are null returns vMin = NULL = = VMin?
		"": Vmin.trim (); Vmax = NULL = = Vmax?
		"": Vmax.trim ();
		if ("". Equals (VMin) && "". Equals (VMax)) {return;
		}//Datavalidationhelper Dvhelper = Sheet.getdatavalidationhelper ();
		Datavalidationconstraint dvconstraint = null; if (ValidationType = = DataValidationConstraint.ValidationType.TEXT_LENGTH) {Dvconstraint =
		Dvhelper.createtextlengthconstraint (Operatortype, VMin, VMax); } else if (ValidationType = = DatAValidationConstraint.ValidationType.DECIMAL) {dvconstraint = Dvhelper.createdecimalconstraint (Operatortype, VMin,
		VMAX); } else if (ValidationType = = DataValidationConstraint.ValidationType.INTEGER) {dvconstraint = Dvhelper.createintegerco
		Nstraint (Operatortype, VMin, VMax); } else if (ValidationType = = DataValidationConstraint.ValidationType.DATE) {dvconstraint = Dvhelper.createdateconstrai
		NT (Operatortype, vMin, vMax, NULL); } else if (ValidationType = = DataValidationConstraint.ValidationType.TIME) {dvconstraint = Dvhelper.createtimeconstrai
		NT (Operatortype, VMin, VMax);
		} if (null = = Dvconstraint) {return; } cellrangeaddresslist AddressList = new Cellrangeaddresslist (RowIndex, Getlastrowindex (Sheet.getworkbook ()),
		Colindex, Colindex);
		datavalidation validation = dvhelper.createvalidation (Dvconstraint, AddressList);
        Set error message Validation.setsuppressdropdownarrow (TRUE);
		Validation.setshowerrorbox (TRUE); Setdatavalidationerrormessage (ValidatiOn, ErrorTitle, errormsg);
	Sheet.addvalidationdata (validation); }


The official does not know whether the bug has been found, did not find the POI forum published.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.