Files
radzen-blazor/RadzenBlazorDemos/Pages/SpreadsheetLocalizationPage.razor

18 lines
945 B
Plaintext
Raw Normal View History

Add culture-aware editing, display, and formula entry to RadzenSpreadsheet The spreadsheet engine parsed typed input with the invariant culture while displaying values with the current culture, breaking the edit round-trip on non-en-US hosts and making comma-decimal entry (10,50) impossible. Workbook gains a Culture property (defaults to CurrentCulture) which the component stamps from its inherited Culture parameter. It drives: - Cell input parsing (CellData type inference), including day-month date handling for cultures where the group and date separators collide (de-DE) - Edit text and display rendering (GetValue, GetValueAsString, GetDisplayText) - Number format rendering - format codes stay canonical invariant tokens while separators, month names, and AM/PM designators follow the culture - Formula entry and display via the new FormulaLocalizer (Excel FormulaLocal semantics: ';' argument separators and ',' decimals in comma-decimal cultures, lenient comma acceptance where unambiguous, canonical invariant storage) - Dialog input (data validation, conditional format, filter) via shared conversion helpers on SpreadsheetDialogBase XLSX and CSV files read and write canonical invariant values regardless of the workbook culture, including autofit column widths. Malformed formulas now surface as error trees instead of an unhandled lexer exception. Number format parsing is cached (hard-bounded) since CellView reparsed per render. Includes localization demos for the Spreadsheet and Document Processing sections and culture test suites. Note: headless code on non-en-US hosts now parses string values with the host culture; set Workbook.Culture explicitly (or to InvariantCulture) for host-independent processing.
2026-07-08 14:54:40 +03:00
@page "/spreadsheet-localization"
<RadzenText TextStyle="TextStyle.H2" TagName="TagName.H1" class="rz-pt-8">
Spreadsheet <strong>Localization</strong>
</RadzenText>
<RadzenText TextStyle="TextStyle.Subtitle1" TagName="TagName.P" class="rz-pb-4">
Set the <code>Culture</code> property to control how RadzenSpreadsheet parses typed input, renders
number formats, and localizes formula entry. In comma-decimal cultures such as de-DE or es-ES users
type <code>10,50</code> for ten and a half and enter formulas as <code>=SUM(A1;B1)</code> or
<code>=A1*1,5</code> - just like Excel. Set <code>UICulture</code> to localize the toolbar and menus.
Files (XLSX, CSV) and the programmatic <code>Cell.Formula</code> API always use canonical invariant
values regardless of the culture.
</RadzenText>
<RadzenExample ComponentName="Spreadsheet" Example="SpreadsheetLocalization">
<SpreadsheetLocalization />
</RadzenExample>