XmlMappedRange.NumberFormatLocal 屬性

取得或設定 XmlMappedRange 控制項的格式化程式碼 (採用使用者語言)。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
Property NumberFormatLocal As Object
Object NumberFormatLocal { get; set; }

屬性值

型別:System.Object
XmlMappedRange 控制項的格式化程式碼 (採用使用者語言)。

備註

Format 功能使用的格式化程式碼字串與 NumberFormatNumberFormatLocal 屬性所使用的不同。

範例

下列程式碼範例使用 NumberFormat 屬性來設定 XmlMappedRange 中日期字串的格式。 這個範例也會使用 NumberFormatLocal 屬性,以使用者的語言顯示日期格式。 此程式碼範例假設目前工作表包含名為 CustomerDateCell 的 XmlMappedRange

Private Sub ApplyNumberFormatting()
    Me.CustomerDateCell.Value2 = "4-Apr-1974"
    Me.CustomerDateCell.NumberFormat = "m/d/yyyy"

    ' Display the number format in the language of the user.
    MsgBox("The number format for CustomerDateCell is: " & _
        Me.CustomerDateCell.NumberFormatLocal.ToString())
End Sub
private void ApplyNumberFormatting()
{
    this.CustomerDateCell.Value2 = "4-Apr-1974";
    this.CustomerDateCell.NumberFormat = "m/d/yyyy";

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

.NET Framework 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間