我的服务员还没准备好安装office
我在我的表单中编写了以下代码。它在我的机器上运行良好,但是当我在网上上传时;这没用。这需要互操作 dll,但服务器人员尚未准备好在服务器上安装 Office。任何人都可以帮助我,因为我需要从 excel 中取消隐藏工作表。
使用excel;
Excel.Application excelApp = new Excel.Application();
string myPath = @fileLocation;
excelApp.Workbooks.Open(myPath, Missing.Value, Missing.Value,Missing.Value, Missing.Value,Missing.Value, Missing.Value,Missing.Value, Missing.Value,Missing.Value, Missing.Value,Missing.Value, Missing.Value);//,Missing.Value, Missing.Value);
//Get the first sheet.
Excel.Worksheet objSheet = (Excel.Worksheet)excelApp.ActiveWorkbook.Sheets["abc"];
//Unhide the worksheet.
objSheet.Visible = Excel.XlSheetVisibility.xlSheetVisible;
//Save As the Excel file.
excelApp.ActiveWorkbook.Save();