无法下载从我们的应用程序中提取的excel文件 [英] Unable to download excel file extracted from our application
问题描述
Quote:
如果可以,我会很高兴帮助建议解决我们的问题,我们的网站托管是当访问者点击特定按钮时生成excel文件,如果这样做它会生成以下错误无法加载文件或程序集Microsoft.Office.Interop.Excel, Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c'或其中一个依赖项。找到的程序集的清单定义与程序集引用不匹配。(HRESULT异常:0x80131040)。
i使用excel.Application Visible =False。
我已将输出定向到流下载
我尝试过:
string PathsTo = directoryPath + drpProgramArea.SelectedItem.Text.Trim()+ - + drpYears.SelectedItem.Text.Trim()+ - + drpYears2.SelectedItem.Text +。xls;
// ============下载Excel文件=================== ==
Response.Clear();
Response.Buffer = true;
Response.Charset = ;
Response.ContentType =application / vnd.openxmlformats- officedocument.spreadsheetml.sheet;
Response.AddHeader(content-disposition,attachment; filename =+ PathsTo;
使用(MemoryStream MyMemoryStream = new MemoryStream())
{
xlWBK.SaveAs(MyMemoryStream);
MyMemoryStream.WriteTo(Response.OutputStream);
Response.Flush();
Response.End();
}
这就是我的尝试。
任何建议都将受到赞赏。
Quote:无法加载文件或程序集'Microsoft.Office.Interop。 Excel,Version = 15.0.0.0,Culture = neutral, PublicKeyToken = 71e9bce111e9429c'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)
此错误消息表明软件包安装有问题。后果,包不能使用。
您可能需要重新安装包。
理想情况下,在另一台计算机上测试您的应用程序,并使用已知可正常工作的包。
Quote:Hi,
I will be happy if you can help suggest solution to our problem, our site hosted is generating excel file when a visitor click the specific button, if that is done it generate the following error "Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)".
i have use the excel.Application Visible ="False".
and i have directed the output to a stream for download
What I have tried:
string PathsTo = directoryPath +drpProgramArea.SelectedItem.Text.Trim()+"- "+drpYears.SelectedItem.Text.Trim()+"-"+drpYears2.SelectedItem.Text + ".xls";
//============ Download Excel file =====================
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application/vnd.openxmlformats- officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=" + PathsTo);
using (MemoryStream MyMemoryStream = new MemoryStream())
{
xlWBK.SaveAs(MyMemoryStream);
MyMemoryStream.WriteTo(Response.OutputStream);
Response.Flush();
Response.End();
}
this is what i have tried.
any suggestion will be appreciated.
Quote:Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This error message suggest that there is something wrong in the package installation. Consequences, the package can't be used.
You probably need to reinstall the package.
Ideally, test your app on another computer with a package known to work ok.
这篇关于无法下载从我们的应用程序中提取的excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!