Skip to content

Conversation

@supermonkeybrainz
Copy link

This adds the protection option to styles for cells. This allows users to lock specific cells. There are other protection options, but this is a good start.

@supermonkeybrainz
Copy link
Author

supermonkeybrainz commented Mar 23, 2024

Allows you to do stuff like this:

  const styles = {
    // Create a reusable style
    unlocked: workbook.createStyle({
      protection: { hidden: false, locked: false },
    }),
  };
  
  worksheet
        .cell(1, 1)
        .string(`test`)
        .style(styles.unlocked);

Then you can lock the sheet like this:

    const worksheetOptions = {
      sheetProtection: { objects: true, scenarios: true, sheet: true },
    };
    const worksheet = workbook.addWorksheet('Test', worksheetOptions);

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.

1 participant