Skip to content

Make exported case numbers clickable with reliably visible hyperlink formatting in XLSX case export#172

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/update-export-feature-hyperlinks
Draft

Make exported case numbers clickable with reliably visible hyperlink formatting in XLSX case export#172
Copilot wants to merge 7 commits intomainfrom
copilot/update-export-feature-hyperlinks

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

Case export already produced .xlsx, but exported case links were plain text and not reliably clickable/styled in spreadsheet apps. This change ensures exported case numbers are emitted as clickable hyperlink cells when a portal case ID exists, using formula-based hyperlinks for more reliable native link rendering.

  • Export behavior updates

    • Kept the exported Case Number text unchanged.
    • When caseId is available, map that case number to PORTAL_CASE_URL/#/{caseId} for hyperlinking.
    • Do not add a separate Case URL column.
  • Workbook hyperlink metadata

    • After generating the worksheet, locate the Case Number column by header.
    • For each case number cell that has a mapped portal URL, set XLSX link metadata (cell.l.Target) so spreadsheet clients render the case number as a clickable hyperlink.
  • Workbook hyperlink rendering update

    • Use Excel HYPERLINK(...) formulas on linked Case Number cells so spreadsheet clients more consistently display native hyperlink formatting.
    • Keep link-target metadata (cell.l.Target) as a compatibility fallback.
    • Apply explicit hyperlink font styling (blue + underline) on linked case number cells.
    • Enable cellStyles: true in XLSX.write(...) so style metadata is actually persisted in the exported workbook.
    • Escape embedded quotes in URL/display text used in formulas.
  • Focused export test coverage

    • Updated export handler tests to remove Case URL column expectations.
    • Added/updated test assertions to verify hyperlink metadata is attached to Case Number cells.
    • Updated assertions to verify formula-based hyperlink behavior (f, t, v) on linked case number cells.
    • Added assertions for hyperlink style metadata and for write options including cellStyles: true.
    • Added edge-case coverage for quote escaping in hyperlink formula values.
    • Kept XLSX worksheet encoding/decoding mocks used by hyperlink assertions.
const caseNumber = cell?.v ? String(cell.v) : '';
const caseUrl = caseNumberToUrlMap.get(caseNumber);
if (caseUrl && cell) {
  const caseNumberCell = cell as XLSX.CellObject;
  const escapedCaseUrl = caseUrl.replace(/"/g, '""');
  const escapedCaseNumber = caseNumber.replace(/"/g, '""');
  caseNumberCell.l = { Target: caseUrl };
  caseNumberCell.f = `HYPERLINK("${escapedCaseUrl}","${escapedCaseNumber}")`;
  caseNumberCell.t = 's';
  caseNumberCell.v = caseNumber;
  caseNumberCell.s = {
    ...existingStyle,
    font: {
      ...existingFont,
      color: { rgb: '0563C1' },
      underline: true,
    },
  };
}

[!WARNING]


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 15, 2026 13:58
Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Copilot AI changed the title [WIP] Update export feature to maintain clickable hyperlinks Make exported case links clickable in XLSX case export Feb 15, 2026
Copilot AI requested a review from jayhill February 15, 2026 14:01
@jayhill
Copy link
Contributor

jayhill commented Feb 15, 2026

@copilot Instead of adding a column with the portal URL for the case, make the case number a clickable hyperlink. Text should remain the case number, and if there is a portal case number (case was found in the portal), then associate it with the portal URL and make it a hyperlink.

Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot Instead of adding a column with the portal URL for the case, make the case number a clickable hyperlink. Text should remain the case number, and if there is a portal case number (case was fou...

Updated in commit c610aac. The export now keeps the displayed text as the case number and applies the hyperlink directly to the Case Number cell when a portal caseId exists. I removed the added Case URL column and adjusted the export tests accordingly.

Copilot AI changed the title Make exported case links clickable in XLSX case export Make exported case numbers clickable hyperlinks in XLSX case export Feb 15, 2026
@jayhill
Copy link
Contributor

jayhill commented Feb 15, 2026

@copilot It looks like the feature works, but there is no visual identifier in the spreadsheet to indicate that there are hyperlinks. Does the styling need to be applied, explicitly or is there a default that can be used? I'd expect blue, underlined text for hyperlinks and the standard text style, if not.

Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot It looks like the feature works, but there is no visual identifier in the spreadsheet to indicate that there are hyperlinks. Does the styling need to be applied, explicitly or is there a defa...

Implemented in commit d804010. I now explicitly apply hyperlink font styling on linked Case Number cells (color: 0563C1 + underline: true) in addition to the hyperlink target, so spreadsheet clients can show a clear visual indicator similar to standard hyperlink styling. This is a backend export-only change (no in-app UI surface changed).

Copilot AI changed the title Make exported case numbers clickable hyperlinks in XLSX case export Make exported case numbers clickable and visibly styled hyperlinks in XLSX case export Feb 15, 2026
@jayhill
Copy link
Contributor

jayhill commented Feb 15, 2026

@copilot I deployed these changes , but the case number links still did not show link-like formatting.

Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot I deployed these changes , but the case number links still did not show link-like formatting.

Updated in commit ff31b0c. I switched linked case-number cells to use an Excel HYPERLINK(...) formula (and kept link target metadata), which should make spreadsheet clients render them with native hyperlink styling more reliably. I also added test coverage for formula escaping edge cases. No in-app UI changed (export-file behavior only).

Copilot AI changed the title Make exported case numbers clickable and visibly styled hyperlinks in XLSX case export Make exported case numbers clickable with reliably visible hyperlink formatting in XLSX case export Feb 15, 2026
@jayhill
Copy link
Contributor

jayhill commented Feb 15, 2026

@copilot I see the HYPERLINK formula, but the text is still not formatted.
image

Co-authored-by: jayhill <116148+jayhill@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot I see the HYPERLINK formula, but the text is still not formatted.
<img width="531" height="160" alt="image" src="https://github.com/user-attachments/assets/3b7f6260-e40a-46b2-89cd-5f4fb4cab6...

Updated in commit 6d481cc. I now keep the HYPERLINK(...) formula and also persist explicit hyperlink styling by writing with cellStyles: true and setting the linked Case Number font to blue + underlined. This should make the hyperlink formatting appear in exported files instead of only showing the formula. Screenshot for context:

Spreadsheet hyperlink display

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants