Skip to content

Commit 04c385f

Browse files
committed
Reset stream position (fixes #331)
1 parent 645d98e commit 04c385f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ExcelMapper/ExcelMapper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ public async Task<IEnumerable<T>> FetchAsync<T>(Stream stream, string sheetName,
792792
public async Task<IEnumerable<dynamic>> FetchAsync(Stream stream, string sheetName, Func<ValueConverterArgs, object> valueConverter = null)
793793
{
794794
using var ms = await ReadAsync(stream);
795+
ms.Position = 0;
795796
return Fetch(ms, sheetName, valueConverter);
796797
}
797798

@@ -806,6 +807,7 @@ public async Task<IEnumerable<dynamic>> FetchAsync(Stream stream, string sheetNa
806807
public async Task<IEnumerable> FetchAsync(Stream stream, Type type, string sheetName, Func<ValueConverterArgs, object> valueConverter = null)
807808
{
808809
using var ms = await ReadAsync(stream);
810+
ms.Position = 0;
809811
return Fetch(ms, type, sheetName, valueConverter);
810812
}
811813

@@ -832,6 +834,7 @@ public async Task<IEnumerable<T>> FetchAsync<T>(Stream stream, int sheetIndex =
832834
public async Task<IEnumerable<dynamic>> FetchAsync(Stream stream, int sheetIndex = 0, Func<ValueConverterArgs, object> valueConverter = null)
833835
{
834836
using var ms = await ReadAsync(stream);
837+
ms.Position = 0;
835838
return Fetch(ms, sheetIndex, valueConverter);
836839
}
837840

@@ -846,6 +849,7 @@ public async Task<IEnumerable<dynamic>> FetchAsync(Stream stream, int sheetIndex
846849
public async Task<IEnumerable> FetchAsync(Stream stream, Type type, int sheetIndex = 0, Func<ValueConverterArgs, object> valueConverter = null)
847850
{
848851
using var ms = await ReadAsync(stream);
852+
ms.Position = 0;
849853
return Fetch(ms, type, sheetIndex, valueConverter);
850854
}
851855

0 commit comments

Comments
 (0)