1
This commit is contained in:
@@ -509,11 +509,10 @@ public class TencentDocController extends BaseController {
|
||||
fileId, sheetId, startRow, endRow, lastMaxRow);
|
||||
|
||||
// 读取表格数据(先读取表头行用于识别列位置)
|
||||
// 腾讯文档V3 API的range格式:startRow,startColumn,endRow,endColumn(从0开始的索引)
|
||||
// 例如:第2行A列到Z列 = "1,0,1,25"(行索引从0开始,所以第2行是索引1)
|
||||
int headerRowIndex = headerRow - 1; // Excel行号转索引(第2行 = 索引1)
|
||||
String headerRange = String.format("%d,0,%d,25", headerRowIndex, headerRowIndex); // 读取A到Z列(0-25)
|
||||
log.info("读取表头 - Excel行号: {}, 索引行号: {}, range: {}", headerRow, headerRowIndex, headerRange);
|
||||
// 根据官方文档,使用 A1 表示法(Excel格式)
|
||||
// 参考:https://docs.qq.com/open/document/app/openapi/v3/sheet/get/get_range.html
|
||||
String headerRange = String.format("A%d:Z%d", headerRow, headerRow); // 例如:A2:Z2
|
||||
log.info("读取表头 - 行号: {}, range: {}", headerRow, headerRange);
|
||||
|
||||
JSONObject headerData = null;
|
||||
try {
|
||||
@@ -566,11 +565,9 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
|
||||
// 读取数据行
|
||||
// 构建数据行的range(从startRow到endRow,A列到Z列)
|
||||
int startRowIndex = startRow - 1; // Excel行号转索引
|
||||
int endRowIndex = endRow - 1; // Excel行号转索引
|
||||
String range = String.format("%d,0,%d,25", startRowIndex, endRowIndex); // 读取A到Z列(0-25)
|
||||
log.info("开始读取数据行 - Excel行号: {} ~ {}, 索引: {} ~ {}, range: {}", startRow, endRow, startRowIndex, endRowIndex, range);
|
||||
// 使用 A1 表示法(Excel格式)
|
||||
String range = String.format("A%d:Z%d", startRow, endRow); // 例如:A3:Z203
|
||||
log.info("开始读取数据行 - 行号: {} ~ {}, range: {}", startRow, endRow, range);
|
||||
|
||||
JSONObject sheetData = null;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user