The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

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.v19.2.Core.dll

Declaration

void CopyFrom(
    BuiltInStyleId id
)
Sub CopyFrom(
    id As BuiltInStyleId
)
void CopyFrom(
    BuiltInStyleId id
)
Sub CopyFrom(
    id As BuiltInStyleId
)
void CopyFrom(
    BuiltInStyleId id
)
Sub CopyFrom(
    id As BuiltInStyleId
)

Parameters

Name Type Description
id BuiltInStyleId

A cell style from which format settings should be copied.

Parameters

Name Type Description
id BuiltInStyleId

A cell style from which format settings should be copied.

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.

Examples

  1. Add a new style to the Workbook.Styles collection by calling the StyleCollection.Add method with the style name passed as a parameter. This method returns the Style object corresponding to the created style. This object's Style.Name property is set to the specified name. Other settings are identical to the Normal built-in style.
  2. To copy all format settings from a Microsoft® Excel® built-in style to the newly created style, use the Style.CopyFrom method with the built-in style id (a BuiltInStyleId enumeration member) passed as a parameter.
  3. Use properties of the newly created Style object to change the required format settings of the style.
// Add a new style under the "My Good Style" name to the Styles 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 required formatting characteristics if needed.
// ...
See Also