The code for ReadExcel. razor is as follows:
@page "/upload-excel"
@using System.IO
`<Field>
<FileEdit Changed="@OnChanged" />
</Field>`
@code {
async Task OnChanged(FileChangedEventArgs e)
{
try
{
var file = e.Files.FirstOrDefault();
if (file == null)
{
return;
}
using (MemoryStream result = new MemoryStream())
{
await file.OpenReadStream(long.MaxValue).CopyToAsync(result);
}
} catch (Exception exc)
{
Console.WriteLine(exc.Message);
} finally
{
this.StateHasChanged();
}
}
}
This is just a simple function of selecting a local Excel file and reading it.
Some source files of your project are broken. Please fix it and share again(run
abp clean
and remove thenode_moduels
). Thanks
Sorry, my project has been encrypted by company software. In fact, this is just an empty ABP module project. You can create one locally and then copy the file "ReadExcel. razor" to open it, which can reproduce the error.
Can you share a template project that reproduces the problem?
I have sent you an email with a template project attachment, please check it.
hi
Set EnableDetailedErrors in AddHubOptions
to see detail errors.builder.Services.AddSignalR(hubOptions => { hubOptions.EnableDetailedErrors = true; });
I set this in the program. cs of Blazor. Server. Host, but it is still the same error. Where can I go to see the detailed information?
I've created a component for reading Excel files that works fine in a blank Blazor project, but when I add it to a Blazor project based on ABP Framework, I get an error message saying 'Invocation provides 4 argument(s) but target expects 3.' Could you please help me understand why this happens and how to fix it? Thank you!"
The following is my code.
@page "/upload-excel"
@using System.IO
<Field>
<FileEdit Changed="@OnChanged" />
</Field>
@code {
async Task OnChanged(FileChangedEventArgs e)
{
try
{
var file = e.Files.FirstOrDefault();
if (file == null)
{
return;
}
using (MemoryStream result = new MemoryStream())
{
await file.OpenReadStream(long.MaxValue).CopyToAsync(result);
}
} catch (Exception exc)
{
Console.WriteLine(exc.Message);
} finally
{
this.StateHasChanged();
}
}
}