diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 717a482f4..84dcc6f4a 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -5175,6 +5175,7 @@
  • Cell Range
  • Editing
  • Formulas
  • +
  • Data Validation
  • Formatting
  • Freeze Panes
  • Context Menu
  • diff --git a/Document-Processing/Excel/Spreadsheet/Javascript-ES6/cell-range.md b/Document-Processing/Excel/Spreadsheet/Javascript-ES6/cell-range.md index a897d643b..88d860829 100644 --- a/Document-Processing/Excel/Spreadsheet/Javascript-ES6/cell-range.md +++ b/Document-Processing/Excel/Spreadsheet/Javascript-ES6/cell-range.md @@ -81,96 +81,6 @@ The following features have some limitations in Merge: * Merge with filter. * Merge with wrap text. -## Data Validation - -Data Validation is used to restrict the user from entering the invalid data. You can use the [`allowDataValidation`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#allowdatavalidation) property to enable or disable data validation. - -> * The default value for `allowDataValidation` property is `true`. - -### Apply Validation - -You can apply data validation to restrict the type of data or the values that users enter into a cell. - -You can apply data validation by using one of the following ways, - -* Select the Data tab in the Ribbon toolbar, and then choose the Data Validation item. -* Use the [`addDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#adddatavalidation) method programmatically. - -### Clear Validation - -Clear validation feature is used to remove data validations from the specified ranges or the whole worksheet. - -You can clear data validation rule by one of the following ways, - -* Select the Data tab in the Ribbon toolbar, and then choose the Clear Validation item. -* Use the [`removeDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#removedatavalidation) method programmatically. - -### Highlight Invalid Data - -Highlight invalid data feature is used to highlight the previously entered invalid values. - -You can highlight an invalid data by using one of the following ways, - -* Select the Data tab in the Ribbon toolbar, and then choose the Highlight Invalid Data item. -* Use the [`addInvalidHighlight()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#addinvalidhighlight) method programmatically. - -### Clear Highlighted Invalid Data - -Clear highlight feature is used to remove the highlight from invalid cells. - -You can clear the highlighted invalid data by using the following ways, - -* Select the Data tab in the Ribbon toolbar, and then choose the Clear Highlight item. -* Use the [`removeInvalidHighlight()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#removeinvalidhighlight) method programmatically. - -{% tabs %} -{% highlight ts tabtitle="index.ts" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs1/index.ts %} -{% endhighlight %} -{% highlight html tabtitle="index.html" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs1/index.html %} -{% endhighlight %} -{% endtabs %} - -{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/data-validation-cs1" %} - -### Custom Data validation - -The Spreadsheet supports custom data validation, allowing users to define their own validation rules for specific cells or ranges. This feature enables you to set conditions that the entered data must meet, making it particularly useful when predefined validation options, such as numbers, dates, or lists, are insufficient. - -With custom validation, you can enforce rules using logical expressions or formulas, ensuring that only valid data is entered into the Spreadsheet. - -For example, consider a scenario where you want to ensure that a cell contains a number between 10 and 100. To achieve this, define a validation rule using a formula that checks if the entered value is greater than 10 and less than 100. The formula for this validation is =AND(A1>10, A1<100), where A1 refers to the cell being validated. - -When this rule is applied, the Spreadsheet evaluates the entered value against the formula. If a user enters a value outside the specified range, an alert notifies them of the invalid input. This helps users correct errors efficiently and ensures that only desired values are accepted. - -You can apply custom data validation using two methods. - -* The first is through the Data Validation dialog in the Ribbon toolbar. Navigate to the Data tab, select the Data Validation option, and choose the Custom type from the Allow dropdown menu. -* The second method is programmatically, using the [`addDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#adddatavalidation) method, which allows developers to set custom rules dynamically via code. - -The following code example demonstrates how to add custom data validation with a formula in a Spreadsheet. - -{% tabs %} -{% highlight ts tabtitle="index.ts" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs3/index.ts %} -{% endhighlight %} -{% highlight html tabtitle="index.html" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs3/index.html %} -{% endhighlight %} -{% endtabs %} - -{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/data-validation-cs3" %} - -### Limitations of Data validation - -The following features have some limitations in Data Validation: - -* Entire row data validation. -* Insert row between the data validation. -* Copy/paste with data validation. -* Delete cells between data validation applied range. - ## Auto Fill Auto Fill is used to fill the cells with data based on adjacent cells. It also follows a pattern from adjacent cells if available. There is no need to enter the repeated data manually. You can use `allowAutoFill` property to enable/disable the auto fill support. You can also use `showFillOptions` property to enable/disable the fill option and `fillType` property to change the default auto fill option which is available in `autoFillSettings`. diff --git a/Document-Processing/Excel/Spreadsheet/Javascript-ES6/data-validation.md b/Document-Processing/Excel/Spreadsheet/Javascript-ES6/data-validation.md index 2cf3fc943..877276273 100644 --- a/Document-Processing/Excel/Spreadsheet/Javascript-ES6/data-validation.md +++ b/Document-Processing/Excel/Spreadsheet/Javascript-ES6/data-validation.md @@ -9,7 +9,7 @@ documentation: ug # Data validation in EJ2 TypeScript Spreadsheet control -Data Validation is used to restrict the user from entering the invalid data. You can use the [`allowDataValidation`](../api/spreadsheet/#allowdatavalidation) property to enable or disable data validation. +Data Validation is used to restrict the user from entering the invalid data. You can use the [`allowDataValidation`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#allowdatavalidation) property to enable or disable data validation. > * The default value for `allowDataValidation` property is `true`. @@ -20,7 +20,7 @@ You can apply data validation to restrict the type of data or the values that us You can apply data validation by using one of the following ways, * Select the Data tab in the Ribbon toolbar, and then choose the Data Validation item. -* Use the [`addDataValidation()`](../api/spreadsheet/#adddatavalidation) method programmatically. +* Use the [`addDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#adddatavalidation) method programmatically. ## Clear Validation @@ -29,7 +29,7 @@ Clear validation feature is used to remove data validations from the specified r You can clear data validation rule by one of the following ways, * Select the Data tab in the Ribbon toolbar, and then choose the Clear Validation item. -* Use the [`removeDataValidation()`](../api/spreadsheet/#removedatavalidation) method programmatically. +* Use the [`removeDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#removedatavalidation) method programmatically. ## Highlight Invalid Data @@ -38,7 +38,7 @@ Highlight invalid data feature is used to highlight the previously entered inval You can highlight an invalid data by using one of the following ways, * Select the Data tab in the Ribbon toolbar, and then choose the Highlight Invalid Data item. -* Use the [`addInvalidHighlight()`](../api/spreadsheet/#addinvalidhighlight) method programmatically. +* Use the [`addInvalidHighlight()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#addinvalidhighlight) method programmatically. ## Clear Highlighted Invalid Data @@ -47,18 +47,55 @@ Clear highlight feature is used to remove the highlight from invalid cells. You can clear the highlighted invalid data by using the following ways, * Select the Data tab in the Ribbon toolbar, and then choose the Clear Highlight item. -* Use the [`removeInvalidHighlight()`](../api/spreadsheet/#removeinvalidhighlight) method programmatically. +* Use the [`removeInvalidHighlight()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#removeinvalidhighlight) method programmatically. {% tabs %} {% highlight ts tabtitle="index.ts" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs2/index.ts %} +{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs1/index.ts %} {% endhighlight %} {% highlight html tabtitle="index.html" %} -{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs2/index.html %} +{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs1/index.html %} {% endhighlight %} {% endtabs %} -{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/data-validation-cs2" %} +{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/data-validation-cs1" %} + +## Custom Data validation + +The Spreadsheet supports custom data validation, allowing users to define their own validation rules for specific cells or ranges. This feature enables you to set conditions that the entered data must meet, making it particularly useful when predefined validation options, such as numbers, dates, or lists, are insufficient. + +With custom validation, you can enforce rules using logical expressions or formulas, ensuring that only valid data is entered into the Spreadsheet. + +For example, consider a scenario where you want to ensure that a cell contains a number between 10 and 100. To achieve this, define a validation rule using a formula that checks if the entered value is greater than 10 and less than 100. The formula for this validation is =AND(A1>10, A1<100), where A1 refers to the cell being validated. + +When this rule is applied, the Spreadsheet evaluates the entered value against the formula. If a user enters a value outside the specified range, an alert notifies them of the invalid input. This helps users correct errors efficiently and ensures that only desired values are accepted. + +You can apply custom data validation using two methods. + +* The first is through the Data Validation dialog in the Ribbon toolbar. Navigate to the Data tab, select the Data Validation option, and choose the Custom type from the Allow dropdown menu. +* The second method is programmatically, using the [`addDataValidation()`](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#adddatavalidation) method, which allows developers to set custom rules dynamically via code. + +The following code example demonstrates how to add custom data validation with a formula in a Spreadsheet. + +{% tabs %} +{% highlight ts tabtitle="index.ts" %} +{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs3/index.ts %} +{% endhighlight %} +{% highlight html tabtitle="index.html" %} +{% include code-snippet/spreadsheet/javascript-es6/data-validation-cs3/index.html %} +{% endhighlight %} +{% endtabs %} + +{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/data-validation-cs3" %} + +## Limitations of Data validation + +The following features have some limitations in Data Validation: + +* Entire row data validation. +* Insert row between the data validation. +* Copy/paste with data validation. +* Delete cells between data validation applied range. ## See Also