-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add subjectID as page name for excel download #1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,8 +7,15 @@ export function downloadExcel(filename: string, recordsExport: InstrumentRecords | |||||||||||||
| writeFileXLSX(workbook, filename); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export function downloadSubjectTableExcel(filename: string, records: { [key: string]: any }[]) { | ||||||||||||||
| export function downloadSubjectTableExcel(filename: string, records: { [key: string]: any }[], name: string) { | ||||||||||||||
| const sanitizedName = | ||||||||||||||
| name | ||||||||||||||
| .replace(/[\\/?*[\]:]/g, '_') // Replace invalid chars | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Escape brackets in the regex. The Apply this diff: - .replace(/[\\/?*[\]:]/g, '_') // Replace invalid chars
+ .replace(/[\\/?*\[\]:]/g, '_') // Replace invalid chars📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| .slice(0, 31) // Max 31 chars | ||||||||||||||
| .replace(/^'|'$/g, '') // Remove leading/trailing apostrophes | ||||||||||||||
| .trim() || 'Subject'; // Fallback if empty | ||||||||||||||
| const workbook = utils.book_new(); | ||||||||||||||
| utils.book_append_sheet(workbook, utils.json_to_sheet(records), 'ULTRA_LONG'); | ||||||||||||||
| utils.book_append_sheet(workbook, utils.json_to_sheet(records), sanitizedName); | ||||||||||||||
| utils.book_append_sheet(workbook, utils.json_to_sheet(records), name); | ||||||||||||||
|
Comment on lines
+18
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the second worksheet with unsanitized name. Creating a worksheet with the unsanitized Apply this diff: utils.book_append_sheet(workbook, utils.json_to_sheet(records), sanitizedName);
- utils.book_append_sheet(workbook, utils.json_to_sheet(records), name);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| writeFileXLSX(workbook, filename); | ||||||||||||||
| } | ||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.