c# - ASP.NET website and ms excel integration -
i working on asp.net website , excel integration project. have excel file having lots of macros performs calculation. can pass values of cells , based on macros formula displays output in other cell of excel. need pass parameters asp.net website , display out put of excel on asp.net webform. able implement functionality using following code , working fine on while development.
application excel = new application(); excel.displayalerts = false; excel.enableevents = true; //excel.visible = true; workbook wb = excel.workbooks.open(path, 0, false, 5, "", "", true, microsoft.office.interop.excel.xlplatform.xlwindows, "\t", true, false, 0, true, 1, 0); worksheet excelsheet = (worksheet)wb.activesheet; excelsheet.cells[37, 11] = 65; excelsheet.cells[37, 9] = 70; excelsheet.cells[14, 8] = "a"; excelsheet.cells[15, 8] = "b"; excelsheet.cells[16, 8] = "c"; try { excel.run("macro1", system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value , system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value, system.reflection.missing.value); } catch (exception ex) { } try { wb.save(); } catch (exception ex) { } list<string> resultlist = new list<string>(); try { resultlist.add((excelsheet.cells[37, 4] range).value.tostring()); } catch (exception ex) { resultlist.add(""); } try { resultlist.add((excelsheet.cells[36, 9] range).value.tostring()); } catch (exception ex) { resultlist.add(""); }
when deploying site production server getting following error -
retrieving com class factory component clsid {00024500-0000-0000-c000-000000000046} failed due following error: 80070005 access denied. (exception hresult: 0x80070005 (e_accessdenied)).
to resolve issue have applied following solution not working - @ of link mentioned publish application 32-bit or 64-bit, developed asp.net website no option 32-bit , 64-bit. @ iis have "enabled 32-bit application" true.
Comments
Post a Comment