NanoXLSX
NanoXLSX copied to clipboard
Set cell value
How can i set the value of a cell retrieved with the Worksheet.GetCell metod? I try set Value property but not work
Hi, A cell object is currently more or less a read-only object. I assume you want to adjust data from a loaded workbook. As a workaround, you can do the following:
- Get the cell "cell1"
- Get the address of the cell
- Add a new cell in in your worksheet with the new value and the address of "cell1". This will override the old cell
worksheet.AddCell(newValue, cell1.CellAddress);
It is probably an enhancement if the value can be set directly.
I think is a good option. Before that the Value property of Cell object should by read only.
Hi, Cell values can now be set by the Value property of the cell. This was possible earlier too, but a type check was missing. This was added now. The fix was released with v2.0.2. The NuGet package should be available in a few minutes
I will close this issue for now. Please do not hesitate to re-open or file a new one, if further problems occur. Thank you for the report.