[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

LabelAlignment

Enum Class LabelAlignment

java.lang.Object
java.lang.Enum<LabelAlignment>
com.grapecity.documents.excel.LabelAlignment
All Implemented Interfaces:
Serializable, Comparable<LabelAlignment>, Constable

public enum LabelAlignment extends Enum<LabelAlignment>
指定单元格标签在区域中的位置。

将此枚举与 ILabelOptions.setAlignment(LabelAlignment) 一起使用,可将单元格标签放置在单元格区域顶部或底部,并左对齐、居中或右对齐。


 IRange range = worksheet.getRange("A1");
 range.setCellPadding(new CellPadding(10,0, 0,0));
 range.setWatermark("Student Name");
 range.getLabelOptions().getFont().setSize(7);
 range.getLabelOptions().setAlignment(LabelAlignment.topCenter);
 
  • Enum Constant Details

    • topLeft

      public static final LabelAlignment topLeft
      表示单元格标签位置为左上角。
    • topCenter

      public static final LabelAlignment topCenter
      表示单元格标签位置为顶部居中。
    • topRight

      public static final LabelAlignment topRight
      表示单元格标签位置为右上角。
    • bottomLeft

      public static final LabelAlignment bottomLeft
      表示单元格标签位置为左下。
    • bottomCenter

      public static final LabelAlignment bottomCenter
      表示单元格标签位置为底部居中。
    • bottomRight

      public static final LabelAlignment bottomRight
      表示单元格标签位置在右下角。
  • Method Details

    • values

      public static LabelAlignment[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LabelAlignment valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public int getValue()
      Gets the integer value of the label alignment.
      Returns:
      The integer value of the label alignment.
    • getLabelAlignment

      public static LabelAlignment getLabelAlignment(int value)
      返回与指定整数值关联的标签位置。

      使用此方法可将存储或序列化的标签对齐值转换为对应的 LabelAlignment 枚举常量。

      
       worksheet.getRange("A1").setWatermark("Student Name");
       int alignmentValue = 4;
       LabelAlignment alignment = LabelAlignment.getLabelAlignment(alignmentValue);
       worksheet.getRange("A1").getLabelOptions().setAlignment(alignment);
       
      Parameters:
      value - 表示标签位置的整数值。
      Returns:
      与指定值关联的 LabelAlignment 枚举常量;如果未找到匹配项,则为 null。