Back to Devexpress

WorkbookColorPalette.CopyFrom(WorkbookColorPalette) Method

officefileapi-devexpress-dot-spreadsheet-dot-workbookcolorpalette-dot-copyfrom-x28-devexpress-dot-spreadsheet-dot-workbookcolorpalette-x29.md

latest2.3 KB
Original Source

WorkbookColorPalette.CopyFrom(WorkbookColorPalette) Method

Copies colors from the specified palette to the current palette.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void CopyFrom(
    WorkbookColorPalette other
)
vb
Sub CopyFrom(
    other As WorkbookColorPalette
)

Parameters

NameTypeDescription
otherWorkbookColorPalette

A workbook palette that contains colors to copy.

|

Exceptions

TypeDescription
ArgumentException

Occurs if other parameter is null ( Nothing in Visual Basic).

|

Remarks

The following code example demonstrates how to copy a color palette from one workbook to another:

csharp
using DevExpress.Spreadsheet;
// ...
using (Workbook sourceWorkbook = new Workbook())
using (Workbook targetWorkbook = new Workbook())
{
    targetWorkbook.LoadDocument("Book1.xlsx");
    sourceWorkbook.LoadDocument("Book2.xlsx");
    targetWorkbook.ColorPalette.CopyFrom(sourceWorkbook.ColorPalette);
}
vb
Imports DevExpress.Spreadsheet
' ...
Using sourceWorkbook As New Workbook()
Using targetWorkbook As New Workbook()
    targetWorkbook.LoadDocument("Book1.xlsx")
    sourceWorkbook.LoadDocument("Book2.xlsx")
    targetWorkbook.ColorPalette.CopyFrom(sourceWorkbook.ColorPalette)
End Using
End Using

See Also

WorkbookColorPalette Interface

WorkbookColorPalette Members

DevExpress.Spreadsheet Namespace