Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excel writer ignore number as string in xlsb files. #172

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/Sylvan.Data.Excel/Xlsb/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ internal enum RecordType

FilterStart = 161,
FilterEnd = 162,

BeginIgnoreError = 648,
IgnoreError = 649,
EndIgnoreError = 650,
}
13 changes: 13 additions & 0 deletions source/Sylvan.Data.Excel/Xlsb/XlsbDataWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,19 @@ async Task<WriteResult> WriteInternal(DbDataReader data, string? worksheetName,
bw.Write(fieldCount - 1);
bw.WriteMarker(RecordType.FilterEnd);

// ignore number as string errors
bw.WriteMarker(RecordType.BeginIgnoreError);

bw.WriteType(RecordType.IgnoreError);
bw.Write7BitEncodedInt(24);
bw.Write(4); // 4 == ignore string as number
bw.Write(1); // 1 range
bw.Write(0); // row start
bw.Write(row - 1); // row end
bw.Write(0); // col start
bw.Write(fieldCount - 1); // col end

bw.WriteMarker(RecordType.EndIgnoreError);

bw.WriteWorksheetEnd();
return new WriteResult(row, complete);
Expand Down