From a8b69108a69095e5230bd38a855f75b7b6bf403a Mon Sep 17 00:00:00 2001 From: Pranita Jain B Date: Thu, 18 Dec 2025 11:12:45 +0530 Subject: [PATCH 1/5] initial --- packages/export/package.json | 2 +- packages/export/src/excel.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/export/package.json b/packages/export/package.json index e682d610f..6cd5f8565 100644 --- a/packages/export/package.json +++ b/packages/export/package.json @@ -1,6 +1,6 @@ { "name": "contexture-export", - "version": "1.3.2", + "version": "1.3.3", "description": "Contexture Exports", "type": "module", "exports": { diff --git a/packages/export/src/excel.js b/packages/export/src/excel.js index 6e4edb2d7..5c90cce16 100644 --- a/packages/export/src/excel.js +++ b/packages/export/src/excel.js @@ -8,6 +8,15 @@ let headerBackgroundColor = '#999999' let indexColumnBackgroundColor = '#bbbbbb' const convertToExcelCell = (value, index) => { + if (value?.meta?.__isHyperlink) { + const excelSafeUrl = value.url.replace(/"/g, '""'); + const displayValue = value.meta.__alias || excelSafeUrl || ''; + return { + value: `HYPERLINK("${excelSafeUrl}", "${displayValue}")`, + type: 'Formula', + wrap: true, + }; + } return { wrap: true, value: value ? `${value}` : ``, From 121811bcd658a6cdf3beeab0c528d410baa59a1c Mon Sep 17 00:00:00 2001 From: Pranita Jain B Date: Thu, 18 Dec 2025 11:36:23 +0530 Subject: [PATCH 2/5] md file added --- .../support_clickable_link_in_export.md | 25 +++++++++++++++++++ packages/export/src/excel.js | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .changeset/support_clickable_link_in_export.md diff --git a/.changeset/support_clickable_link_in_export.md b/.changeset/support_clickable_link_in_export.md new file mode 100644 index 000000000..d098a1ae8 --- /dev/null +++ b/.changeset/support_clickable_link_in_export.md @@ -0,0 +1,25 @@ + +# Release Notes: contexture-export + +## [Patch] - Hyperlink Support for Excel Exports + +### Overview +This patch introduces a new feature for Excel-type exports where cells can now be rendered as clickable hyperlinks. This is achieved by providing a specific metadata structure that the exporter converts into native Excel formulas. + +### New Features +* **Dynamic Excel Hyperlinks**: Cells can now display a custom text label while linking to a specific URL. +* **Metadata-Driven Rendering**: The system identifies links via the `__isHyperlink` flag within the `meta` object. +* **Display Label Mapping**: The `__alias` property is used as the visible display label for the provided URL. +* **Formula Safety**: The exporter automatically handles double-quote escaping to ensure the Excel `HYPERLINK` formula remains valid. + +### Data Structure Requirements +To render a cell as a link, the record data for that cell must follow this structure: + +```json +{ + "url": "[https://example.com/detail/123](https://example.com/detail/123)", + "meta": { + "__isHyperlink": true, + "__alias": "Click to Open Detail Link" + } +} \ No newline at end of file diff --git a/packages/export/src/excel.js b/packages/export/src/excel.js index 5c90cce16..77740b4c1 100644 --- a/packages/export/src/excel.js +++ b/packages/export/src/excel.js @@ -9,8 +9,8 @@ let indexColumnBackgroundColor = '#bbbbbb' const convertToExcelCell = (value, index) => { if (value?.meta?.__isHyperlink) { - const excelSafeUrl = value.url.replace(/"/g, '""'); - const displayValue = value.meta.__alias || excelSafeUrl || ''; + const excelSafeUrl = value?.url?.replace(/"/g, '""')||''; + const displayValue = value?.meta?.__alias || excelSafeUrl || ''; return { value: `HYPERLINK("${excelSafeUrl}", "${displayValue}")`, type: 'Formula', From 2e7dd715cd4ee7f8256d2ce7247667d1ce2087ed Mon Sep 17 00:00:00 2001 From: Pranita Jain B Date: Thu, 18 Dec 2025 11:46:14 +0530 Subject: [PATCH 3/5] md file modified --- .changeset/support_clickable_link_in_export.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/support_clickable_link_in_export.md b/.changeset/support_clickable_link_in_export.md index d098a1ae8..416cbb3f8 100644 --- a/.changeset/support_clickable_link_in_export.md +++ b/.changeset/support_clickable_link_in_export.md @@ -17,9 +17,9 @@ To render a cell as a link, the record data for that cell must follow this struc ```json { - "url": "[https://example.com/detail/123](https://example.com/detail/123)", + "url": "https://example.com/detail/123", "meta": { "__isHyperlink": true, - "__alias": "Click to Open Detail Link" + "__alias": "Click to Open Link" } } \ No newline at end of file From 9b751365cd9b29f6363fa66a73fa1b936755692e Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 18 Dec 2025 06:59:29 +0000 Subject: [PATCH 4/5] Fix code style issues with Prettier --- .changeset/support_clickable_link_in_export.md | 15 +++++++++------ packages/export/src/excel.js | 12 ++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.changeset/support_clickable_link_in_export.md b/.changeset/support_clickable_link_in_export.md index 416cbb3f8..8714096d6 100644 --- a/.changeset/support_clickable_link_in_export.md +++ b/.changeset/support_clickable_link_in_export.md @@ -1,18 +1,20 @@ - # Release Notes: contexture-export ## [Patch] - Hyperlink Support for Excel Exports ### Overview + This patch introduces a new feature for Excel-type exports where cells can now be rendered as clickable hyperlinks. This is achieved by providing a specific metadata structure that the exporter converts into native Excel formulas. ### New Features -* **Dynamic Excel Hyperlinks**: Cells can now display a custom text label while linking to a specific URL. -* **Metadata-Driven Rendering**: The system identifies links via the `__isHyperlink` flag within the `meta` object. -* **Display Label Mapping**: The `__alias` property is used as the visible display label for the provided URL. -* **Formula Safety**: The exporter automatically handles double-quote escaping to ensure the Excel `HYPERLINK` formula remains valid. + +- **Dynamic Excel Hyperlinks**: Cells can now display a custom text label while linking to a specific URL. +- **Metadata-Driven Rendering**: The system identifies links via the `__isHyperlink` flag within the `meta` object. +- **Display Label Mapping**: The `__alias` property is used as the visible display label for the provided URL. +- **Formula Safety**: The exporter automatically handles double-quote escaping to ensure the Excel `HYPERLINK` formula remains valid. ### Data Structure Requirements + To render a cell as a link, the record data for that cell must follow this structure: ```json @@ -22,4 +24,5 @@ To render a cell as a link, the record data for that cell must follow this struc "__isHyperlink": true, "__alias": "Click to Open Link" } -} \ No newline at end of file +} +``` diff --git a/packages/export/src/excel.js b/packages/export/src/excel.js index 77740b4c1..1ac8f02fd 100644 --- a/packages/export/src/excel.js +++ b/packages/export/src/excel.js @@ -8,15 +8,15 @@ let headerBackgroundColor = '#999999' let indexColumnBackgroundColor = '#bbbbbb' const convertToExcelCell = (value, index) => { - if (value?.meta?.__isHyperlink) { - const excelSafeUrl = value?.url?.replace(/"/g, '""')||''; - const displayValue = value?.meta?.__alias || excelSafeUrl || ''; + if (value?.meta?.__isHyperlink) { + const excelSafeUrl = value?.url?.replace(/"/g, '""') || '' + const displayValue = value?.meta?.__alias || excelSafeUrl || '' return { value: `HYPERLINK("${excelSafeUrl}", "${displayValue}")`, type: 'Formula', - wrap: true, - }; - } + wrap: true, + } + } return { wrap: true, value: value ? `${value}` : ``, From e4c3e67c0715d4df4370d0886f5b546652342750 Mon Sep 17 00:00:00 2001 From: Pranita Jain B Date: Fri, 19 Dec 2025 11:51:32 +0530 Subject: [PATCH 5/5] url value directly used,cleaning removed --- packages/export/src/excel.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/export/src/excel.js b/packages/export/src/excel.js index 1ac8f02fd..2b14e0408 100644 --- a/packages/export/src/excel.js +++ b/packages/export/src/excel.js @@ -9,10 +9,9 @@ let indexColumnBackgroundColor = '#bbbbbb' const convertToExcelCell = (value, index) => { if (value?.meta?.__isHyperlink) { - const excelSafeUrl = value?.url?.replace(/"/g, '""') || '' - const displayValue = value?.meta?.__alias || excelSafeUrl || '' + const displayValue = value?.meta?.__alias || value?.url || 'Link' return { - value: `HYPERLINK("${excelSafeUrl}", "${displayValue}")`, + value: `HYPERLINK("${value?.url}", "${displayValue}")`, type: 'Formula', wrap: true, }