mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Replace the old Spreadsheet Import & Export demo with a dedicated
Document Processing section: Spreadsheet API (generate XLSX/CSV from
a typed list), Import & Export (XLSX and CSV subsections, imported
data rendered in RadzenTable, configurable CSV options with live
preview), and Formulas (in-code workbook formulas, stateless
Formula.Evaluate, stateful FormulaEngine, custom FormulaFunction).
Each multi-section demo follows the H5+RadzenExample convention with
matching Toc entries. Descriptions and titles rewritten around what
users search for ("Excel", "XLSX", "CSV", "import/export",
"evaluate Excel formulas in C#") rather than internal API names.
Also ships the public FormulaEngine surface and its contract tests.
61 lines
2.1 KiB
Plaintext
61 lines
2.1 KiB
Plaintext
@using Radzen.Documents.Spreadsheet
|
|
|
|
<RadzenTable>
|
|
<RadzenTableHeader>
|
|
<RadzenTableHeaderRow>
|
|
<RadzenTableHeaderCell>Cell</RadzenTableHeaderCell>
|
|
<RadzenTableHeaderCell>Value</RadzenTableHeaderCell>
|
|
</RadzenTableHeaderRow>
|
|
</RadzenTableHeader>
|
|
<RadzenTableBody>
|
|
<RadzenTableRow>
|
|
<RadzenTableCell Style="font-family:monospace">A1</RadzenTableCell>
|
|
<RadzenTableCell>
|
|
<RadzenNumeric @bind-Value=@a1 TValue="double" Change=@(_ => Recompute()) Style="width:120px" />
|
|
</RadzenTableCell>
|
|
</RadzenTableRow>
|
|
<RadzenTableRow>
|
|
<RadzenTableCell Style="font-family:monospace">B1</RadzenTableCell>
|
|
<RadzenTableCell>
|
|
<RadzenNumeric @bind-Value=@b1 TValue="double" Change=@(_ => Recompute()) Style="width:120px" />
|
|
</RadzenTableCell>
|
|
</RadzenTableRow>
|
|
<RadzenTableRow>
|
|
<RadzenTableCell Style="font-family:monospace">C1</RadzenTableCell>
|
|
<RadzenTableCell Style="font-family:monospace">
|
|
<span style="opacity:0.6">=A1+B1</span>
|
|
→
|
|
<strong>@c1Result</strong>
|
|
</RadzenTableCell>
|
|
</RadzenTableRow>
|
|
<RadzenTableRow>
|
|
<RadzenTableCell Style="font-family:monospace">D1</RadzenTableCell>
|
|
<RadzenTableCell Style="font-family:monospace">
|
|
<span style="opacity:0.6">=C1*2</span>
|
|
→
|
|
<strong>@d1Result</strong>
|
|
</RadzenTableCell>
|
|
</RadzenTableRow>
|
|
</RadzenTableBody>
|
|
</RadzenTable>
|
|
|
|
@code {
|
|
double a1 = 2;
|
|
double b1 = 3;
|
|
string c1Result = "";
|
|
string d1Result = "";
|
|
|
|
protected override void OnInitialized() => Recompute();
|
|
|
|
void Recompute()
|
|
{
|
|
var engine = new FormulaEngine();
|
|
engine.Set("A1", a1);
|
|
engine.Set("B1", b1);
|
|
engine.Set("C1", "=A1+B1");
|
|
engine.Set("D1", "=C1*2");
|
|
c1Result = engine.Get("C1")?.ToString() ?? "(null)";
|
|
d1Result = engine.Get("D1")?.ToString() ?? "(null)";
|
|
}
|
|
}
|