mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Rename the 34 public toolbar tool components and the two public base classes to the RadzenSpreadsheet* convention in the Radzen.Blazor namespace, matching RadzenHtmlEditor*. This removes name collisions (Color, Bold, Open, Save...), makes them discoverable via the Radzen prefix, and drops the special @using Radzen.Blazor.Spreadsheet.Tools a custom toolbar previously needed. Make Open and Save work in a custom toolbar: they now read the cascaded context instead of host-wired parameters. Add ISpreadsheet.LoadWorkbookAsync (one host render, reused by the built-in Open) so the grid refreshes on load; Save derives the workbook from the cascaded Worksheet. The internal dialogs and ConditionalFormatRuleType stay in their sub-namespace.
61 lines
1.9 KiB
Plaintext
61 lines
1.9 KiB
Plaintext
@using Radzen.Blazor.Spreadsheet
|
|
@using Radzen.Documents.Spreadsheet
|
|
|
|
<RadzenSpreadsheet Workbook=@workbook SelectedToolsetIndex="0" style="height: 500px">
|
|
<RadzenTabsItem Text="Review">
|
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="0.125rem" AlignItems="AlignItems.Center">
|
|
<RadzenSpreadsheetUndo />
|
|
<RadzenSpreadsheetRedo />
|
|
<div class="rz-toolbar-separator"></div>
|
|
<StampReviewedTool />
|
|
</RadzenStack>
|
|
</RadzenTabsItem>
|
|
</RadzenSpreadsheet>
|
|
|
|
@code {
|
|
Workbook workbook = new Workbook();
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
var sheet = workbook.AddSheet("Reviews", 10, 4);
|
|
|
|
sheet.BeginUpdate();
|
|
|
|
sheet.Columns[0] = 160;
|
|
sheet.Columns[1] = 260;
|
|
sheet.Columns[2] = 240;
|
|
|
|
var headerFormat = new Format { Bold = true, BackgroundColor = "#1565c0", Color = "#ffffff", TextAlign = Radzen.TextAlign.Center };
|
|
|
|
string[] headers = { "Product", "Notes", "Reviewed" };
|
|
for (int i = 0; i < headers.Length; i++)
|
|
{
|
|
sheet.Cells[0, i].Value = headers[i];
|
|
sheet.Cells[0, i].Format = headerFormat;
|
|
}
|
|
|
|
var rows = new (string Product, string Notes)[]
|
|
{
|
|
("Laptop Pro 14", "Looks great"),
|
|
("Ultra Monitor", "Verify color accuracy"),
|
|
("Ergo Keyboard", "Approved"),
|
|
("Wireless Mouse", "Battery life?"),
|
|
("Noise Headset", "Solid mic"),
|
|
("USB Dock", "Heat under load"),
|
|
};
|
|
|
|
for (int i = 0; i < rows.Length; i++)
|
|
{
|
|
int r = i + 1;
|
|
sheet.Cells[r, 0].Value = rows[i].Product;
|
|
sheet.Cells[r, 1].Value = rows[i].Notes;
|
|
}
|
|
|
|
// Start the cursor on the first empty Reviewed cell so the tool is one click away.
|
|
sheet.Selection.Select(CellRef.Parse("C2"));
|
|
sheet.Rows.Frozen = 1;
|
|
|
|
sheet.EndUpdate();
|
|
}
|
|
}
|