Skip to content

Commit 8af113f

Browse files
authored
Merge pull request #90 from TypingMind/fix-excel-plugin
Fix: add optional tag to startCell
2 parents 125f7b8 + 32eefee commit 8af113f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/routes/excelGenerator/excelGeneratorModel.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ export const ExcelGeneratorRequestBodySchema = z
2626
title: z.string().optional().openapi({
2727
description: 'The title of the table, which will be displayed in the first row.',
2828
}),
29-
startCell: z.string().openapi({
30-
description: "The starting cell (e.g., 'A1') where the table will begin.",
29+
startCell: z.string().optional().default('A1').openapi({
30+
description:
31+
"The starting cell (e.g., 'A1') where the table will begin. Defaults to A1 if not specified.",
3132
}),
3233
columns: z
3334
.array(

src/routes/excelGenerator/excelGeneratorRouter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function execGenExcelFuncs(sheetsData: SheetData[], excelConfigs: ExcelCo
186186

187187
sheetsData.forEach(({ sheetName, tables }) => {
188188
const worksheet = workbook.addWorksheet(sheetName);
189-
tables.forEach(({ startCell, title, rows = [], columns = [], skipHeader }) => {
189+
tables.forEach(({ startCell = 'A1', title, rows = [], columns = [], skipHeader }) => {
190190
const startCol = columnLetterToNumber(startCell[0]); // Convert column letter to index (e.g., 'A' -> 1)
191191
const startRow = parseInt(startCell.slice(1)); // Extract the row number (e.g., 'A1' -> 1)
192192
let rowIndex = startRow; // Set the initial row index to startRow for each table

0 commit comments

Comments
 (0)