Compare commits
No commits in common. "3bd232059f0e60fa2800c87ffa1e0bd60e11e33f" and "f53e9e6aff3f891bd2ade0f30bbea85dc21872d0" have entirely different histories.
3bd232059f
...
f53e9e6aff
46
README.md
46
README.md
@ -22,14 +22,14 @@ feishu-table-helper 是一个简化飞书表格操作的 Java 库。通过使用
|
||||
<dependency>
|
||||
<groupId>cn.isliu</groupId>
|
||||
<artifactId>feishu-table-helper</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.2</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle
|
||||
|
||||
```gradle
|
||||
implementation 'cn.isliu:feishu-table-helper:0.0.3'
|
||||
implementation 'cn.isliu:feishu-table-helper:0.0.2'
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
@ -38,29 +38,22 @@ implementation 'cn.isliu:feishu-table-helper:0.0.3'
|
||||
|
||||
```java
|
||||
// 初始化配置
|
||||
try (FsClient fsClient = FsClient.getInstance()) {
|
||||
fsClient.initializeClient("your_app_id","your_app_secret");
|
||||
}
|
||||
FsClient.getInstance().initializeClient("your_app_id", "your_app_secret");
|
||||
```
|
||||
|
||||
### 2. 创建实体类
|
||||
|
||||
```java
|
||||
@TableConf(headLine = 3, titleRow = 2, enableDesc = true)
|
||||
public class Employee extends BaseEntity {
|
||||
|
||||
@TableProperty(value = {"ID", "员工信息", "员工编号"}, order = 0, desc = "员工编号不超过20个字符")
|
||||
private String employeeId;
|
||||
|
||||
@TableProperty(value = {"ID", "员工信息", "姓名"}, order = 1, desc = "员工姓名不超过20个字符")
|
||||
@TableProperty(value = "姓名", order = 1)
|
||||
private String name;
|
||||
|
||||
@TableProperty(value = "部门", order = 3, desc = "员工部门不超过20个字符")
|
||||
private String department;
|
||||
|
||||
@TableProperty(value = {"员工信息", "邮箱"}, order = 2, desc = "员工邮箱不超过50个字符")
|
||||
|
||||
@TableProperty(value = "邮箱", order = 2)
|
||||
private String email;
|
||||
|
||||
|
||||
@TableProperty(value = "部门", order = 3)
|
||||
private String department;
|
||||
|
||||
// getters and setters...
|
||||
}
|
||||
```
|
||||
@ -72,8 +65,6 @@ public class Employee extends BaseEntity {
|
||||
String sheetId = FsHelper.create("员工表", "your_spreadsheet_token", Employee.class);
|
||||
```
|
||||
|
||||

|
||||
|
||||
### 4. 写入数据
|
||||
|
||||
```java
|
||||
@ -107,17 +98,16 @@ employees.forEach(emp -> System.out.println(emp.name + " - " + emp.email));
|
||||
- `fieldFormatClass()`: 字段格式化处理类
|
||||
- `optionsClass()`: 选项处理类
|
||||
|
||||
### @TableConf
|
||||
## 配置选项
|
||||
|
||||
用于配置表格样式:
|
||||
通过 [FsConfig](file://../src/main/java/cn/isliu/core/config/FsConfig.java#L5-L55) 类可以配置以下选项:
|
||||
|
||||
- `headLine()`: 表头行数
|
||||
- `titleLine()`: 标题行数
|
||||
- `enableCover()`: 是否开启覆盖写入
|
||||
- `isText()`: 是否设置表格为纯文本
|
||||
- `headFontColor()`: 表头字体颜色
|
||||
- `headBackColor()`: 表头背景颜色
|
||||
- `enableDesc()`: 是否开启字段描述
|
||||
- `headLine`: 表头行号
|
||||
- `titleLine`: 标题行号
|
||||
- `isCover`: 是否覆盖写入
|
||||
- `CELL_TEXT`: 是否设置单元格为文本格式
|
||||
- `FORE_COLOR`: 前景色
|
||||
- `BACK_COLOR`: 背景色
|
||||
|
||||
## 依赖
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user