Class RowKit

java.lang.Object
org.aoju.bus.office.excel.RowKit

public class RowKit extends Object
Excel中的行Row封装工具类
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.poi.ss.usermodel.Row
    getOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
    获取已有行或创建新行
    static void
    insertRow(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int insertNumber)
    插入行
    static List<Object>
    readRow(org.apache.poi.ss.usermodel.Row row, int startCellNumInclude, int endCellNumInclude, CellEditor cellEditor)
    读取一行
    static List<Object>
    readRow(org.apache.poi.ss.usermodel.Row row, CellEditor cellEditor)
    读取一行
    static void
    removeRow(org.apache.poi.ss.usermodel.Row row)
    从工作表中删除指定的行,此方法修复sheet.shiftRows删除行时会拆分合并的单元格的问题
    static void
    writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, CellEditor cellEditor)
    写一行数据,无样式,非标题
    static void
    writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader, CellEditor cellEditor)
    写一行数据

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RowKit

      public RowKit()
  • Method Details

    • getOrCreateRow

      public static org.apache.poi.ss.usermodel.Row getOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
      获取已有行或创建新行
      Parameters:
      sheet - Excel表
      rowIndex - 行号
      Returns:
      Row
    • readRow

      public static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, CellEditor cellEditor)
      读取一行
      Parameters:
      row - 行
      cellEditor - 单元格编辑器
      Returns:
      单元格值列表
    • readRow

      public static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, int startCellNumInclude, int endCellNumInclude, CellEditor cellEditor)
      读取一行
      Parameters:
      row - 行
      startCellNumInclude - 起始单元格号,0开始(包含)
      endCellNumInclude - 结束单元格号,0开始(包含)
      cellEditor - 单元格编辑器
      Returns:
      单元格值列表
    • writeRow

      public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, CellEditor cellEditor)
      写一行数据,无样式,非标题
      Parameters:
      row - 行
      rowData - 一行的数据
      cellEditor - 单元格值编辑器,可修改单元格值或修改单元格,null表示不编辑
    • writeRow

      public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader, CellEditor cellEditor)
      写一行数据
      Parameters:
      row - 行
      rowData - 一行的数据
      styleSet - 单元格样式集,包括日期等样式,null表示无样式
      isHeader - 是否为标题行
      cellEditor - 单元格值编辑器,可修改单元格值或修改单元格,null表示不编辑
    • insertRow

      public static void insertRow(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int insertNumber)
      插入行
      Parameters:
      sheet - 工作表
      startRow - 插入的起始行
      insertNumber - 插入的行数
    • removeRow

      public static void removeRow(org.apache.poi.ss.usermodel.Row row)
      从工作表中删除指定的行,此方法修复sheet.shiftRows删除行时会拆分合并的单元格的问题
      Parameters:
      row - 需要删除的行