Style.CopyFrom(BuiltInStyleId) Method
Duplicates the format settings of the specified built-in style into the current Style instance.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v20.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
NuGet Packages: DevExpress.Spreadsheet.Core, DevExpress.WindowsDesktop.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
id | BuiltInStyleId | A cell style from which format settings should be copied. |
Remarks
You can duplicate a built-in style using the CopyFrom property to create your own custom style. For more information on cell styles and examples on how to manage them, see the Formatting Cells and How to: Create or Modify a Style topics.
Example
Use the StyleCollection.Add method to add a new style to the Workbook.Styles collection.
Call the
Style.CopyFrom
method for the created style to copy all format settings from the specified Microsoft® Excel® built-in style to the new style.
// Add a new style under the "My Good Style" name to the style collection.
Style myGoodStyle = workbook.Styles.Add("My Good Style");
// Copy all format settings from the built-in Good style.
myGoodStyle.CopyFrom(BuiltInStyleId.Good);
// Modify the style's format characteristics if needed.
// ...