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

PasteType

Enum Class PasteType

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

public enum PasteType extends Enum<PasteType>
指定在区域复制操作中要粘贴的内容类型。

与 IRange.copy(IRange,PasteOption) 或 PasteOption.setPasteType(java.util.EnumSet) 配合使用,可以控制源区域的哪些方面被粘贴到目标位置。可以使用 EnumSet 组合多个值。


 worksheet.getRange("A1:B2").setValue(new Object[][] {
     {"Name", "Price"},
     {"Apple", 1.99}
 });
 worksheet.getRange("A1:B1").getFont().setBold(true);
 // Copy only values (without formatting) to another range
 PasteOption option = new PasteOption();
 option.setPasteType(EnumSet.of(PasteType.Values));
 worksheet.getRange("A1:B2").copy(worksheet.getRange("D1"), option);
 
  • Enum Constant Details

    • Values

      public static final PasteType Values
      指定仅粘贴单元格值。
    • Formulas

      public static final PasteType Formulas
      指定仅粘贴单元格公式。
    • Formats

      public static final PasteType Formats
      指定仅粘贴格式。
    • NumberFormats

      public static final PasteType NumberFormats
      指定仅粘贴数字格式。
    • ColumnWidths

      public static final PasteType ColumnWidths
      指定仅粘贴列宽。
    • RowHeights

      public static final PasteType RowHeights
      指定仅粘贴行高。
  • Field Details

    • Default

      public static final EnumSet<PasteType> Default
      指定粘贴除行高和列宽之外的所有数据。
  • Method Details

    • values

      public static PasteType[] 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 PasteType 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