Skip to content

Read-Only Spreadsheet #8402

@marcobsidian

Description

@marcobsidian

Describe your motivation

A while ago, we started using the Spreadsheet Component for the following use cases:

  • Displaying the contents of Read-Only Excel-Files
  • Editing Worksheet-Properties (writing to and from XSSFWorkbooks saved as Base64-Strings)

Currently, the biggest problem with using the Component is preventing the user from entering values, when they shouldn't, like in the file preview or when viewing unmodifiable datasets.

Currently, this can only be achieved by Password-locking the Sheets of the Workbook, which has the following problems:

  • Locking the sheets modifies the Workbook, resulting in different Base64, so our Editor fires a value change
  • Password-Locking the sheets does not prevent new Sheets from being created
  • After locking the sheets, a component reload is required, which causes the UI to flicker every time

Another way of preventing user input, we have tried is setting the inert attribute and preventing pointer events. This however kills all interactions, leaving the user unable to select cells or change the sheet on multi-page Spreadsheets.

Describe the solution you'd like

There needs to be a way of setting a Spreadsheet to read-only, separate from the internal Workbook.

A read-only Spreadsheet prevents all interactions that would modify the Workbook, like adding/removing comments and sheets, pasting/writing text, drag-filling cells, etc.

Setting a Spreadsheet to read-only is not synced with the Workbook, it's just the state of the Vaadin component.

Describe alternatives you've considered

  • Password-Locking Sheets
  • Element inert attribute and style pointer-events: none

see above for why this did not work

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions