Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .changeset/support_clickable_link_in_export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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",
"meta": {
"__isHyperlink": true,
"__alias": "Click to Open Link"
}
}
```
2 changes: 1 addition & 1 deletion packages/export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "contexture-export",
"version": "1.3.2",
"version": "1.3.3",
"description": "Contexture Exports",
"type": "module",
"exports": {
Expand Down
8 changes: 8 additions & 0 deletions packages/export/src/excel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ let headerBackgroundColor = '#999999'
let indexColumnBackgroundColor = '#bbbbbb'

const convertToExcelCell = (value, index) => {
if (value?.meta?.__isHyperlink) {
const displayValue = value?.meta?.__alias || value?.url || 'Link'
return {
value: `HYPERLINK("${value?.url}", "${displayValue}")`,
type: 'Formula',
wrap: true,
}
}
return {
wrap: true,
value: value ? `${value}` : ``,
Expand Down