共用方式為


XmlMappedRange.HorizontalAlignment 屬性

取得或設定 XmlMappedRange 控制項的水平對齊。

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

語法

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

屬性值

型別:System.Object
其中一個 XlHAlign 值。

備註

特定 XlHAlign 常數可能無法使用,視該語言支援 (例如美式英語),.. 您所選取或安裝的語言。

範例

下列程式碼會使用 HorizontalAlignment 和 VerticalAlignment 屬性,將 XmlMappedRange 內容對齊右下方。這個程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

Private Sub AlignBottomRight()
    Me.CustomerLastNameCell.HorizontalAlignment = _
        Excel.XlHAlign.xlHAlignRight
    Me.CustomerLastNameCell.VerticalAlignment = _
        Excel.XlVAlign.xlVAlignBottom
    Me.CustomerLastNameCell.Value2 = "The contents " & _
        "of this cell are aligned to the bottom right."
    Me.CustomerLastNameCell.RowHeight = 100
    Me.CustomerLastNameCell.ColumnWidth = 75
End Sub
private void AlignBottomRight()
{
    this.CustomerLastNameCell.HorizontalAlignment = 
        Excel.XlHAlign.xlHAlignRight;
    this.CustomerLastNameCell.VerticalAlignment =
        Excel.XlVAlign.xlVAlignBottom;

    this.CustomerLastNameCell.Value2 = "The contents " +
        "of this cell are aligned to the bottom right.";
    this.CustomerLastNameCell.RowHeight = 100;
    this.CustomerLastNameCell.ColumnWidth = 75;
}

.NET Framework 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間