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

LabelVisibility

Enum Class LabelVisibility

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

public enum LabelVisibility extends Enum<LabelVisibility>
指定单元格标签水印的可见性。

将此枚举与 IRange.getLabelOptions() 和 ILabelOptions.setVisibility(LabelVisibility) 一起使用,可控制水印显示在填充区域、单元格区域,还是根据单元格是否有值自动显示。使用 visible 可始终在填充区域中显示水印,使用 hidden 可根据单元格值在单元格区域中显示水印,使用 auto 可在这两种行为之间自动切换。


 IRange range = worksheet.getRange("A3");
 range.setWatermark("OTHER INFORMATION");
 range.setCellPadding(new CellPadding(20, 0, 0, 0));
 range.getLabelOptions().setVisibility(LabelVisibility.visible);
 range.getLabelOptions().setForeColor(Color.FromArgb(51, 51, 51));
 range.getLabelOptions().setMargin(new Margin(2, 0, 0, 0));
 range.getLabelOptions().getFont().setSize(7);
 LabelVisibility visibility = range.getLabelOptions().getVisibility();
 
  • Enum Constant Details

    • visible

      public static final LabelVisibility visible
      指定无论单元格是否有值,水印始终显示在填充区域中,并且不显示在单元格区域中。
    • hidden

      public static final LabelVisibility hidden
      指定水印不显示在填充区域中,而是根据单元格是否有值显示在单元格区域中。
    • auto

      public static final LabelVisibility auto
      指定当单元格包含值时水印显示在填充区域中,当单元格为空时水印显示在单元格区域中。
  • Method Details

    • values

      public static LabelVisibility[] 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 LabelVisibility 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()
      获取与此 LabelVisibility 常量关联的整数值。
      Returns:
      此 LabelVisibility 常量的整数值。
    • getLabelVisibility

      public static LabelVisibility getLabelVisibility(int value)
      获取与指定整数值对应的 LabelVisibility 常量。
      Parameters:
      value - 要转换的整数值。
      Returns:
      匹配的 LabelVisibility 常量,如果没有找到匹配项则返回 null。