-
Notifications
You must be signed in to change notification settings - Fork 80
Added new kb article spreadsheet-hide-toolbar-formula-sheet-bar #2722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dimodi
merged 3 commits into
master
from
new-kb-spreadsheet-hide-toolbar-formula-sheet-bar-4367a8c92b2d44d8adbbc0bc11426480
Jan 23, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
knowledge-base/spreadsheet-hide-toolbar-formula-sheet-bar.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| title: Hide Toolbar, Formula Bar, or Sheet Bar in Spreadsheet | ||
| description: Learn how to hide the toolbar, formula bar, and sheet bar in theTelerik Spreadsheet component for Blazor. | ||
| type: how-to | ||
| page_title: How to Change the Visibility of Spreadsheet Parts in Blazor | ||
| slug: spreadsheet-kb-hide-toolbar-formula-sheet-bar | ||
| tags: spreadsheet, blazor, toolbar, formula bar, sheet bar, css, visibility | ||
| res_type: kb | ||
| ticketid: 1676073 | ||
| --- | ||
|
|
||
| ## Environment | ||
|
|
||
| <table> | ||
| <tbody> | ||
| <tr> | ||
| <td>Product</td> | ||
| <td>Spreadsheet for Blazor</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| ## Description | ||
|
|
||
| I want to display only the spreadsheet portion and hide the toolbar, formula bar, and sheet bars in the Spreadsheet component. | ||
|
|
||
| ## Solution | ||
|
|
||
| To change the visibility of the toolbar, formula bar, and sheet bar in the Spreadsheet for Blazor, apply conditional CSS classes to hide the respective components. | ||
|
|
||
| >caption This approach is applicable only if the app can trust its users not to show back the tools through the browser console. | ||
|
|
||
| ````RAZOR | ||
| <style> | ||
| .hide-header .k-spreadsheet-header { | ||
| display: none; | ||
| } | ||
|
|
||
| .hide-action-bar .k-spreadsheet-action-bar { | ||
| display: none; | ||
| } | ||
|
|
||
| .hide-sheets-bar .k-spreadsheet-sheets-bar { | ||
| display: none; | ||
| } | ||
| </style> | ||
|
|
||
| <label for="showHeader"><TelerikCheckBox Id="showHeader" @bind-Value="@ShowHeader" />Show Header</label> | ||
| <label for="showActionBar"><TelerikCheckBox Id="showActionBar" @bind-Value="@ShowActionBar" />Show Action Bar</label> | ||
| <label for="showSheetsBar"><TelerikCheckBox Id="showSheetsBar" @bind-Value="@ShowSheetsBar" />Show Sheets Bar</label> | ||
|
|
||
| <TelerikSpreadsheet Data="@SpreadsheetData" | ||
| Class="@SpreadsheetClass"> | ||
| </TelerikSpreadsheet> | ||
|
|
||
| @code { | ||
| private byte[]? SpreadsheetData { get; set; } | ||
| private bool ShowHeader { get; set; } | ||
| private bool ShowActionBar { get; set; } | ||
| private bool ShowSheetsBar { get; set; } | ||
|
|
||
| // Dynamically generate the class based on the checkbox states | ||
| private string SpreadsheetClass => $"{(ShowHeader ? "" : "hide-header")} " + | ||
| $"{(ShowActionBar ? "" : "hide-action-bar")} " + | ||
| $"{(ShowSheetsBar ? "" : "hide-sheets-bar")}"; | ||
|
|
||
| protected override async Task OnInitializedAsync() | ||
| { | ||
| SpreadsheetData = Convert.FromBase64String(SampleExcelFile); | ||
|
|
||
| // Or, load a file from your file system. | ||
| // Specify the full File namespace or use namespace aliases | ||
| // to avoid ambiguous reference with the Telerik SVG icon File. | ||
| // FileData = System.IO.File.ReadAllBytes("C:\\Documents\\MyWorkbook.xlsx"); | ||
|
|
||
| await base.OnInitializedAsync(); | ||
| } | ||
|
|
||
| private const string SampleExcelFile = ""; | ||
| } | ||
| ```` | ||
|
|
||
| ## See Also | ||
|
|
||
| * [Spreadsheet Overview](slug://spreadsheet-overview) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.