Skip to content

Spreadsheet produces error when importing Excel files that contain 6-character color codes #4943

@zstoyanova9

Description

@zstoyanova9

Description

When importing an Excel file that contains 6-character color codes (e.g. 3366CC) in its cell styles, the import fails with the following JavaScript error:

TypeError: Cannot read properties of null (reading '2')
    at toCSSColor (index-esm.js)
    at getColor (index-esm.js)

Files that use 8-character color codes (e.g. FF3366CC) or only named/indexed colors load correctly. The issue can be triggered by any tool or library that generates XLSX files with 6-character color values - Apache POI is one known example.

Steps To Reproduce

spreadsheet-6char-color.xlsx.zip

  1. Download the attached Excel file that was pre-built to contain a 6-character color value.
  2. Try to import it in the Spreadsheet in the following demo - https://demos.telerik.com/kendo-angular-ui/demos/spreadsheet/tools/menu?theme=meridian-main
  3. Open the browser console to observe the error.

Screenshots or video

Image

Actual Behavior

The import throws an unhandled error and cannot render the Excel file.

Expected Behavior

The file should load and the Spreadsheet should display the content. Custom colors should render correctly, or fall back to a default if unsupported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions