获取或设置 XmlMappedRange 控件的水平对齐方式。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
Property HorizontalAlignment As Object
    Get
    Set
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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。