Hi, Wijmo support,
Brief code samples:
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, C1.AspNetCore.Mvc
@addTagHelper *, C1.AspNetCore.Mvc.FlexSheet
=====
Razor component:
@FlexSheet control using TagHelper@
<c1-flex-sheet class=“flexSheet” id=“flexSheet”
show-errors=“true”
enable-drag-drop=“true”
remote-saved=“onFileSaved”
load-action-url=“@Url.Action(“RemoteBind”)”
save-action-url=“@Url.Action(“SaveData”)”
enable-formulas=“true”
item-validator=“validateCell”>
=====
JS part:
const flexSheet = wijmo.Control.getControl(‘#flexSheet’);
For formating on the Front-end side now we use nothing, but had several approaches like below:
function formatNumberCell(row, col) {
const cellValue = flexSheet.getCellValue(row, col);
const cellStyle = flexSheet.selectedSheet.getCellStyle(row, col);
const trimmedValue = cellValue.toString().substr(0, 10);
const numbersAfterPoint = getDecimalFormat(trimmedValue);
cellStyle.format = 'n' + numbersAfterPoint;
flexSheet.setCellData(row, col, trimmedValue);
}
we tried to use a self-written function with native flexSheet.itemFormatter and flexSheet.cellEditEnded methods, but for the formula bar couldn’t find an approach or some relative callbacks.
We are looking for a way to allow users to input numbers “like is” without applying any rounds, trims, and so on.
Several examples:
B5 cell:
1 . data from backend 0.00521, show in cell 0.00521
2. User changed value in the cell B5 to 0.0052100001, expected output in the cell “as is”, e.g. 0.0052100001
3. User changed value in the formula bar for cell B5 from 0.0052100001 to 0.0052100, expected output 0.00521 (should trim trailing zeros)
4. User decided to apply the formula for cell B5. For example, we would like to add several cells, Insert formula directly in the cell B5 (or from formula bar) value =A4+A5, where value for A4 - 1.123 and for A5 - 2.554564, EXPECTED output in the cell B5 → 3.677564
C# dependencies:
c1.aspnetcore.mvc.flexsheet(3.0.20212.322)
gembox.spreadsheet(47.0.1268)
c1.aspnetcore.api(3.0.20212.302)
c1.aspnetcore.mvc(3.0.20212.322)
King regards