Skip to content

Commit

Permalink
Assign null string value in DataCell
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinungf committed Jan 20, 2024
1 parent 94eb054 commit dad216f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SpreadCheetah/DataCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public readonly record struct DataCell
/// </summary>
public DataCell(string? value)
{
StringValue = value ?? string.Empty;
StringValue = value;
Type = value != null ? CellWriterType.String : CellWriterType.Null;
}

Expand Down
3 changes: 3 additions & 0 deletions SpreadCheetah/SpreadsheetBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public bool AppendFormatted<T>(T value)

public bool AppendFormatted(string? value)
{
if (value is null)
return true;

if (XmlUtility.TryXmlEncodeToUtf8(value.AsSpan(), GetSpan(), out var bytesWritten))
{
_pos += bytesWritten;
Expand Down

0 comments on commit dad216f

Please sign in to comment.