Proprietà WorkbookBase.Theme

Ottiene il tema applicato alla cartella di lavoro.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property Theme As OfficeTheme
public OfficeTheme Theme { get; }

Valore proprietà

Tipo: Microsoft.Office.Core.OfficeTheme
Oggetto Microsoft.Office.Core.OfficeTheme che rappresenta il tema applicato alla cartella di lavoro.

Esempi

Nell'esempio di codice riportato di seguito viene recuperato il tema della cartella di lavoro corrente.Vengono quindi visualizzati i nomi del tipo di carattere principale e secondario trovato nella combinazione tipi di carattere del tema della cartella di lavoro.

Questo esempio è valido per una personalizzazione a livello di documento.

Private Sub GetDocumentTheme()
    Dim theme As Office.OfficeTheme = Me.Theme
    Dim fontScheme As Office.ThemeFontScheme = theme.ThemeFontScheme
    Dim majorFont As Office.ThemeFont = fontScheme.MajorFont.Item( _
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin)
    Dim minorFont As Office.ThemeFont = fontScheme.MinorFont.Item( _
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin)
    MessageBox.Show("Name of major font in current document theme: " _
                    + majorFont.Name)
    MessageBox.Show("Name of minor font in current document theme: " _
                    + minorFont.Name)
End Sub
private void GetDocumentTheme()
{
    Office.OfficeTheme theme = this.Theme;
    Office.ThemeFontScheme fontScheme = theme.ThemeFontScheme;
    Office.ThemeFont majorFont = fontScheme.MajorFont.Item(
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin);
    Office.ThemeFont minorFont = fontScheme.MinorFont.Item(
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin);
    MessageBox.Show("Name of major font in current document theme: "
                    + majorFont.Name);
    MessageBox.Show("Name of minor font in current document theme: "
                    + minorFont.Name);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

WorkbookBase Classe

Spazio dei nomi Microsoft.Office.Tools.Excel