Proprietà NamedRange.NumberFormatLocal

Ottiene o imposta il codice di formattazione per il controllo NamedRange nella lingua dell'utente.

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

Sintassi

'Dichiarazione
Property NumberFormatLocal As Object
    Get
    Set
Object NumberFormatLocal { get; set; }

Valore proprietà

Tipo: System.Object
Codice di formattazione per il controllo NamedRange nella lingua dell'utente.

Note

La funzione Format utilizza stringhe di codice di formattazione diverse rispetto alle proprietà NumberFormat e NumberFormatLocal.

Esempi

Nell'esempio di codice riportato di seguito viene utilizzata la proprietà NumberFormat per formattare una stringa di data in un controllo NamedRange. Viene inoltre utilizzata la proprietà NumberFormatLocal per visualizzare il formato della data nella lingua dell'utente.

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

Private formatRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub ApplyNumberFormatting()
    formatRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "formatRange")

    Me.formatRange.Value2 = "4-Apr-1974"
    Me.formatRange.NumberFormat = "m/d/yyyy"

    ' Display the number format in the language of the user.
    MessageBox.Show("The number format for the NamedRange is: " & _
        Me.formatRange.NumberFormatLocal.ToString())
End Sub
Microsoft.Office.Tools.Excel.NamedRange formatRange;
private void ApplyNumberFormatting()
{
    formatRange = this.Controls.AddNamedRange(
         this.Range["C1", missing], "formatRange");

    this.formatRange.Value2 = "4-Apr-1974";
    this.formatRange.NumberFormat = "m/d/yyyy";

    // Display the number format in the language of the user.
    MessageBox.Show("The number format for the NamedRange is: " +
        this.formatRange.NumberFormatLocal.ToString());
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

NamedRange Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Excel