Description
on the other devices throwing this exception:
System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<System.IO.Stream> System.IO.Compression.ZipArchiveEntry.OpenAsync(System.Threading.CancellationToken)'.
at MiniExcelLibs.OpenXml.Styles.SheetStyleBuildContext.CreateAsync(SheetStyleElementInfos generatedElementInfos, CancellationToken cancellationToken)
at MiniExcelLibs.OpenXml.Styles.SheetStyleBuildContext.CreateAsync(SheetStyleElementInfos generatedElementInfos, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.StartTStateMachine
at MiniExcelLibs.OpenXml.Styles.SheetStyleBuildContext.CreateAsync(SheetStyleElementInfos generatedElementInfos, CancellationToken cancellationToken)
at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.GetSheetStyleBuilderAsync(CancellationToken cancellationToken)
at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.SaveAsAsync(CancellationToken cancellationToken)
at MiniExcelLibs.MiniExcel.SaveAsAsync(Stream stream, Object value, Boolean printHeader, String sheetName, ExcelType excelType, IConfiguration configuration, CancellationToken cancellationToken)
however we tested last preview version too but threw this exception:
System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<System.IO.Compression.ZipArchive> System.IO.Compression.ZipArchive.CreateAsync(System.IO.Stream, System.IO.Compression.ZipArchiveMode, Boolean, System.Text.Encoding, System.Threading.CancellationToken)'.
at MiniExcelLib.OpenXml.Writer.OpenXmlWriter.CreateAsync(Stream stream, Object value, String sheetName, Boolean printHeader, IMiniExcelConfiguration configuration, CancellationToken cancellationToken)
at MiniExcelLib.OpenXml.Writer.OpenXmlWriter.CreateAsync(Stream stream, Object value, String sheetName, Boolean printHeader, IMiniExcelConfiguration configuration, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.StartTStateMachine
at MiniExcelLib.OpenXml.Writer.OpenXmlWriter.CreateAsync(Stream stream, Object value, String sheetName, Boolean printHeader, IMiniExcelConfiguration configuration, CancellationToken cancellationToken)
at MiniExcelLib.OpenXml.OpenXmlExporter.ExportAsync(Stream stream, Object value, Boolean printHeader, String sheetName, OpenXmlConfiguration configuration, IProgress`1 progress, CancellationToken cancellationToken)
at MiniExcelLibs.MiniExcel.SaveAsAsync(Stream stream, Object value, Boolean printHeader, String sheetName, ExcelType excelType, IConfiguration configuration, IProgress`1 progress, CancellationToken cancellationToken)
the code works on my system but the same code and the same request not working on my collegue's pc
Expected Behavior
write excel file
Actual Behavior
exception of zip archive method not found
Environment (please fill the following information):
- MiniExcel Version: [1.46.0]
- .NET Version: .net10.0
- OS: Windows
Files and/or Screenshots
the final code, maybe its helpful
...
var config=GetOpenXmlConfiguration(writeItems);
await stream.SaveAsAsync(
list,
printHeader: _options.HasHeader,
sheetName: $"Sheet{_options.SheetIndex + 1}",
excelType: ExcelType.XLSX,
cancellationToken: cancellationToken,
configuration: config);
private MiniExcelLibs.OpenXml.OpenXmlConfiguration GetOpenXmlConfiguration(List<List<WriteItem>> writeItems)
{
var maxLength = writeItems
.SelectMany(z => z)
.Max(x => x.ColumnTitle.Length);
var maxLength2 = writeItems
.SelectMany(z => z)
.Where(x=> x?.Value!=null)
.Max(x => x.Value.ToString().Length);
maxLength=maxLength>maxLength2 ? maxLength : maxLength2;
maxLength += 5;
var firstRow = writeItems.First();
var columns = firstRow
.OrderBy(x=>x.Order)
.Select(x => new DynamicExcelColumn(x.ColumnName)
{
Name = x.ColumnTitle,
Width = maxLength,
})
.ToArray();
var config = new MiniExcelLibs.OpenXml.OpenXmlConfiguration()
{
DynamicColumns = columns,
TableStyles = TableStyles.Default,
RightToLeft = true,
TrimColumnNames = true,
};
return config;
}
Description
on the other devices throwing this exception:
however we tested last preview version too but threw this exception:
the code works on my system but the same code and the same request not working on my collegue's pc
Expected Behavior
write excel file
Actual Behavior
exception of zip archive method not found
Environment (please fill the following information):
Files and/or Screenshots
the final code, maybe its helpful