> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Performance Issues

> Diagnose and resolve slow Excel and PDF export times for large Nextedy RISKSHEET documents, particularly those with hierarchical cell merging.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## Identify the Bottleneck

Export performance issues in Risksheet primarily stem from cell merging in hierarchical layouts. The export engine must calculate merge boundaries for every merged region in the grid, and this computation grows significantly with document size. Use this decision matrix to identify your specific bottleneck:

| Factor                                   | Impact                                                                 | Mitigation                                       |
| ---------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------ |
| Cell merging (hierarchical view)         | **High** -- primary bottleneck for both Excel and PDF                  | Switch to Flat table view before exporting       |
| Number of `multiItemLink` columns        | **High** -- each cell requires JSON array parsing and label resolution | Reduce visible link columns using saved views    |
| Total row count (500+ rows)              | **Medium** -- linear scaling with row count                            | Split large sheets by FMEA type or component     |
| Server-rendered columns                  | **Medium** -- requires HTML-to-text conversion per cell                | Minimize server-rendered columns in export views |
| Conditional formatting / cell decorators | **Low** -- CSS evaluation is fast                                      | Minimal impact on export time                    |
| Column count                             | **Low** -- horizontal scaling is manageable                            | Use `hideColumns` parameter in PDF scripts       |

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/t34k0QhMnn4JCqkc/risksheet/diagrams/troubleshooting/export-performance/diagram-1.svg?fit=max&auto=format&n=t34k0QhMnn4JCqkc&q=85&s=6113eb448944a51b485734c5609f001c" alt="diagram" style={{ maxWidth: "580px", width: "100%" }} width="580" height="310" data-path="risksheet/diagrams/troubleshooting/export-performance/diagram-1.svg" />
</Frame>

## Switch to Flat Table View for Export

The most effective optimization is switching to Flat table view before exporting. This eliminates the merge calculation overhead entirely.

1. Open your Risksheet document
2. Switch to the **Flat table view** using the view selector in the toolbar
3. Trigger the export (Excel or PDF) -- the progress toast appears: "Exporting to Excel" or "Exporting to PDF" with an animated progress indicator
4. Wait for the export to complete and the file to download
5. Switch back to your preferred hierarchical view after the export completes

<Tip title="Dramatic Performance Improvement">
  Switching from hierarchical view to Flat table view reduced export time from approximately **3 hours to 3-7 minutes** in real customer scenarios with large, heavily merged risksheets. Always use Flat table view for large document exports.
</Tip>

The `masterMergeOnly` property (labeled as `flatTable` in export diagnostic logs) controls whether the export uses a flat table structure or includes hierarchical merges. Both `mergeCacheFlag` and `masterMergeOnly` are logged during export for diagnostics.

## Configure Performance Parameters

### Enable Module-Only Permissions

Set `moduleOnlyPermissions=true` at the project level to speed up loading of large sheets. This parameter restricts permission checks to the document module level, avoiding per-item permission evaluation that can be very slow for documents with hundreds of work items.

<Warning title="Permission Granularity Trade-Off">
  Enabling `moduleOnlyPermissions` disables per-item permission checks. If your project relies on fine-grained per-work-item permissions, this optimization may allow users to see or edit items they should not have access to. Verify your permission requirements before enabling.
</Warning>

### Prevent Full Page Reload on Save

Set `refreshOnSave` to `false` in your sheet configuration to avoid a full page reload after each save operation:

```yaml theme={null}
global:
  refreshOnSave: false
```

This prevents the grid from reloading all data after every save, which is particularly beneficial when editing large sheets with many linked items.

<Warning title="`refreshOnSave` and Link Rendering">
  Setting `refreshOnSave` to `false` improves save performance but may cause stale link rendering in some scenarios. Links created or modified during the editing session may not reflect their latest state until the page is manually refreshed. Test with your specific configuration before applying broadly.
</Warning>

### Reduce Visible Columns Before Exporting

Use saved views to create an export-specific column visibility preset that hides columns not needed in the export output:

1. Create a saved view with only the columns required for the export
2. Switch to that view before triggering the export
3. The export processes only visible columns, reducing per-row processing time

This is especially effective for sheets with many `multiItemLink` columns, as each requires JSON array parsing and label resolution during export.

## Optimize PDF Export

PDF export has additional validation requirements and processing steps beyond Excel export.

### Pre-Export Validation

PDF export validates the sheet state before proceeding:

| Validation                    | Behavior When Failed                                                   |
| ----------------------------- | ---------------------------------------------------------------------- |
| Unsaved changes (`isDirty()`) | Export is **blocked**. Save all changes first.                         |
| Comparison mode active        | Export is **blocked**. Exit baseline comparison view before exporting. |

If the export is blocked, Risksheet displays a validation message explaining which condition failed. Save your changes or exit comparison mode, then retry.

### Custom PDF Export Scripts

PDF export uses Velocity templates to generate the export layout. Review your custom `pdfscript.js` for potential inefficiencies:

* Use the `hideColumns` parameter (comma-separated binding names) to exclude unnecessary columns from the `exportMainSheet` call. Hidden columns are temporarily removed during export and restored afterward.
* Consider using `exportSubTable` or `exportDownstreamTable` for focused exports of specific data subsets rather than exporting the entire grid.
* The `emptyPlaceholder` property controls what text appears for null or empty cells. Set this to `null` (default) to skip rendering empty cells entirely.

Available export scope variables in custom scripts:

| Variable          | Description                                        |
| ----------------- | -------------------------------------------------- |
| `exporter`        | The export engine instance with all export methods |
| `isInCompare`     | Whether comparison mode is active                  |
| `compareRevision` | The revision being compared against                |
| `currentRevision` | The current document revision                      |
| `showUnchanged`   | Whether to display unchanged rows in comparison    |

### Known PDF Export Limitations

| Issue                               | Description                                                                                       | Status                                                                    |
| ----------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| Text truncation for linked elements | Cell height calculation may truncate text for linked elements (hazard, hazardous situation, harm) | Fix planned with highest priority                                         |
| Text repetition on page breaks      | When a risk item spans multiple pages, partial text is repeated on the next page for context      | By design, but can confuse reviewers who interpret it as a new risk entry |
| Risk matrix calculation errors      | Risk matrix totals in PDF may not correctly count risks across all severity categories            | Under investigation                                                       |
| Table overflow for long text        | Tables may not auto-extend for very long text content                                             | Under investigation                                                       |

<Warning title="PDF Export Text Truncation">
  PDF export cell height calculation has a known regression that can truncate text for linked elements. This is tracked as a high-priority issue. Check for updates in Risksheet version **v25.2.0 and later**, which includes optimizations for merged cell processing.
</Warning>

## Optimize Excel Export

Excel export processes each cell type individually during the formatting callback. Understanding how each column type is exported helps you identify optimization opportunities:

| Column Type         | Export Behavior                                                          | Performance Notes                                                            |
| ------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
| Plain text / string | Direct value copy                                                        | Fast                                                                         |
| Boolean             | Converts checkbox to `true`/`false` text                                 | Fast                                                                         |
| Item link           | Strips HTML markup, outputs plain text                                   | Moderate -- HTML parsing per cell                                            |
| Multi-item link     | Parses JSON array of `{id, label}` objects, joins with newlines          | Slow -- JSON parsing per cell, items with IDs starting with `*` are prefixed |
| Multi-enum          | Resolves enum IDs to display names from configuration, joins with commas | Moderate -- lookup per value                                                 |
| Server-rendered     | Strips HTML, preserves line breaks from list items                       | Moderate -- HTML processing                                                  |

The export always includes:

* **Column headers** in bold font at the top of the sheet
* **Row headers** showing system item IDs in bold font
* **Cell styles** (background colors, text colors) preserved from the grid when `includeStyles` is active

### Excel Export Progress Feedback

During export, Risksheet displays a progress toast notification:

* **Title:** "Exporting to Excel"
* **Message:** "Please wait while the file is being generated..."
* **Behavior:** The toast persists until the export completes, then automatically dismisses. A 100ms delay ensures the progress indicator renders before the export engine begins processing.

## Version-Specific Improvements

| Version | Improvement                                  | Impact                                                                  |
| ------- | -------------------------------------------- | ----------------------------------------------------------------------- |
| v24.8.5 | `moduleOnlyPermissions=true` parameter       | Faster loading for large sheets by reducing permission check overhead   |
| v24.8.6 | Faster merger for `multiItemLink` columns    | Improved merge calculation for sheets with many multi-item link columns |
| v25.2.0 | Optimized merged cell processing for exports | Reduced export time for hierarchically merged sheets                    |

<Tip title="Update to Latest Version">
  If you are experiencing export performance issues, ensure you are running Risksheet v25.2.0 or later, which includes cumulative performance optimizations for merged cell processing, permission checks, and multi-item link handling.
</Tip>

## Verification

After applying performance optimizations:

1. Switch to **Flat table view** in the Risksheet toolbar
2. Optionally, switch to an export-specific saved view to reduce visible columns
3. Trigger the export and observe the progress indicator ("Exporting to Excel" or "Exporting to PDF")
4. Confirm the export completes within minutes, not hours
5. Open the exported file and verify that all expected data is present

You should now see the export complete significantly faster, with the progress toast displaying briefly before the file downloads. For very large documents (500+ rows with many link columns), expect export times of 3-7 minutes in Flat table view.

## See Also

* [Calculated Columns Missing in Exports](/risksheet/troubleshooting/calculated-columns-export) -- missing calculated data in exports
* [Slow Page Loading](/risksheet/troubleshooting/performance-slow-loading) -- general grid loading performance optimization
* [Baseline Loading Issues](/risksheet/troubleshooting/baselines-loading) -- exit comparison mode before PDF export
* [Rendering and Display Errors](/risksheet/troubleshooting/rendering-errors) -- display issues that may appear related to export problems
* [Error Messages Reference](/risksheet/troubleshooting/error-messages) -- error codes and their meanings

<LastReviewed date="2026-06-24" />
