使用microsoft.office.interop.excel组件不会在客户端打开Excel / Word文件 [英] Excel/Word files is not opened on client side using of microsoft.office.interop.excel component
问题描述
我使用了microsoft.office.interop.excel组件来打开word和excel文件。
它在本地主机上工作正常,但在服务器机器上部署后。它不是在客户端计算机上打开。
我从客户端计算机上点击但是在服务器计算机上打开了文件。
我的示例代码在这里:
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = true;
Excel.Workbook newWorkbook = excelApp.Workbooks.Add();
$
string workbookPath = path;
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath ,
0,false,5,"" ;,"",false,Excel.XlPlatform.xlWindows,"",&bbsp; true,false,0,true,false,false);
$
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
$
string currentSheet =" Sheet1"; $
Excel.Worksheet excelWor ksheet =(Excel.Worksheet)excelSheets.get_Item(currentSheet);
Excel.Range excelCell =(Excel.Range)excelWorksheet.get_Range(" A1"," A1");
请解决方案
     
问候,
Jayesh Prajapati
问题很可能是服务器上的权限(当您对本地主机拥有权限时)或服务器上未安装Excel。
我猜这是一个权限问题,如果是这样,您需要在IIS中以管理员身份登录时设置权限。
Hi,
I am used microsoft.office.interop.excel component for the opening of word and excel files.
It's working fine on local host machine but after deployed on server machine. it's not opening on client machine.
I am click from client machine but file opened on server machine.
my sample code here:
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = true;
Excel.Workbook newWorkbook = excelApp.Workbooks.Add();
string workbookPath = path;
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1", "A1");
Please solution
Regards,
Jayesh Prajapati
The issue most likely is either permissions on the server (while you have permissions on local host) or Excel is not installed on the server.
My guess this is a permission issue and if so you will need to set permissions in IIS logging in as an administrator.
这篇关于使用microsoft.office.interop.excel组件不会在客户端打开Excel / Word文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!