Back to Devexpress

WorkbookTheme.Load(Stream) Method

officefileapi-devexpress-dot-spreadsheet-dot-workbooktheme-dot-load-x28-system-dot-io-dot-stream-x29.md

latest2.3 KB
Original Source

WorkbookTheme.Load(Stream) Method

Loads a custom theme from a stream and applies it to the document.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void Load(
    Stream stream
)
vb
Sub Load(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

A stream that contains a THMX file with a theme definition.

|

Remarks

In Microsoft® Excel®, you can save a document theme as a .thmx file to reuse this theme in other documents. Refer to the following topic for details: Save a Custom Theme for Reuse. The WorkbookTheme.Load method allows you to load a file with a custom theme and to apply it to your workbook.

The following code snippet applies the Quotable theme to the document:

csharp
using DevExpress.Spreadsheet;
using System.IO;
// ...

WorkbookTheme docTheme = workbook.Theme;
using (FileStream stream = File.Open(@"CustomThemes\Quotable.thmx", FileMode.Open))
    docTheme.Load(stream);
vb
Imports DevExpress.Spreadsheet
Imports System.IO
' ...

Dim docTheme As WorkbookTheme = workbook.Theme
Using stream As FileStream = File.Open("CustomThemes\Quotable.thmx", FileMode.Open)
    docTheme.Load(stream)
End Using

See Also

WorkbookTheme Interface

WorkbookTheme Members

DevExpress.Spreadsheet Namespace