c# - OWC gives error on publish website -
i have develop web app. not have office on server , want deploy publish folder on there.
is microsoft office madatory owc? if yes there way can use without excel installed?
using system.web; using system.io; using owc11; namespace aspnetresources.owc { public partial class _default : system.web.ui.page { // ------------------------------------------------------------------ protected void page_load(object sender, system.eventargs e) { if (!page.ispostback) buildcharts (); } // ------------------------------------------------------------------ private void buildcharts () { string[] chartcategoriesarr = new string [] {"accord coupe", "accord sedan", "civic coupe", "civic sedan", "civic si"}; string[] chartvaluesarr = new string []{"19400", "15900", "13710", "13010", "19070"}; string chartcategoriesstr = string.join ("\t", chartcategoriesarr); string chartvaluesstr = string.join ("\t", chartvaluesarr); owc11.chartspaceclass ochartspace = new owc11.chartspaceclass (); owc11.chartcharttypeenum charttype; /*-------------------------------------------------------------- * try using different char types fun * ------------------------------------------------------------- charttype = chartcharttypeenum.chcharttypearea; charttype = chartcharttypeenum.chcharttypearea3d; charttype = chartcharttypeenum.chcharttypebarclustered; charttype = chartcharttypeenum.chcharttypebar3d; charttype = chartcharttypeenum.chcharttypecolumnclustered; charttype = chartcharttypeenum.chcharttypecolumn3d; charttype = chartcharttypeenum.chcharttypedoughnut; charttype = chartcharttypeenum.chcharttypelinestacked; charttype = chartcharttypeenum.chcharttypeline3d; charttype = chartcharttypeenum.chcharttypelinemarkers; charttype = chartcharttypeenum.chcharttypepie; charttype = chartcharttypeenum.chcharttypepie3d; charttype = chartcharttypeenum.chcharttyperadarsmoothline; charttype = chartcharttypeenum.chcharttypesmoothline; */ // ------------------------------------------------------------------------ // give pie , doughnut charts legend on bottom. rest of // them let control figure out on own. // ------------------------------------------------------------------------ charttype = chartcharttypeenum.chcharttypecolumn3d; if (charttype == chartcharttypeenum.chcharttypepie || charttype == chartcharttypeenum.chcharttypepie3d || charttype == chartcharttypeenum.chcharttypedoughnut) { ochartspace.haschartspacelegend = true; ochartspace.chartspacelegend.position = chartlegendpositionenum.chlegendpositionbottom; } ochartspace.border.color = "white"; ochartspace.charts.add(0); ochartspace.charts[0].hastitle = true; ochartspace.charts[0].type = charttype; ochartspace.charts[0].chartdepth = 125; ochartspace.charts[0].aspectratio = 80; ochartspace.charts[0].title.caption = "pricing of 2004 hondas"; ochartspace.charts[0].title.font.bold = true; ochartspace.charts[0].seriescollection.add(0); ochartspace.charts[0].seriescollection[0].datalabelscollection.add (); // ------------------------------------------------------------------------ // if you're charting pie or variation thereof percentages make lot // more sense values... // ------------------------------------------------------------------------ if (charttype == chartcharttypeenum.chcharttypepie || charttype == chartcharttypeenum.chcharttypepie3d || charttype == chartcharttypeenum.chcharttypedoughnut) { ochartspace.charts[0].seriescollection[0].datalabelscollection[0].haspercentage = true; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].hasvalue = false; } // ------------------------------------------------------------------------ // not other chart types values have more meaning // percentages. // ------------------------------------------------------------------------ else { ochartspace.charts[0].seriescollection[0].datalabelscollection[0].haspercentage = false; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].hasvalue = true; } // ------------------------------------------------------------------------ // plug own visual bells , whistles here // ------------------------------------------------------------------------ ochartspace.charts[0].seriescollection[0].caption = string.empty; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].font.name = "verdana"; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].font.size = 10; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].font.bold = true; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].font.color = "white"; ochartspace.charts[0].seriescollection[0].datalabelscollection[0].position = chartdatalabelpositionenum.chlabelpositioncenter; ochartspace.charts[0].seriescollection[0].setdata (owc11.chartdimensionsenum.chdimcategories, convert.toint32(owc11.chartspecialdatasourcesenum.chdataliteral), chartcategoriesstr); ochartspace.charts[0].seriescollection[0].setdata (owc11.chartdimensionsenum.chdimvalues, convert.toint32(owc11.chartspecialdatasourcesenum.chdataliteral), chartvaluesstr); // ------------------------------------------------------------------------ // pick favorite image format // ------------------------------------------------------------------------ byte[] bytearr = (byte[]) ochartspace.getpicture ("png", 500, 500); // ------------------------------------------------------------------------ // store chart image in session picked httphandler later // ------------------------------------------------------------------------ httpcontext ctx = httpcontext.current; string chartid = guid.newguid ().tostring (); ctx.session [chartid] = bytearr; imghondalineup.imageurl = string.concat ("chart.ashx?", chartid); } #region web form designer generated code override protected void oninit(eventargs e) { initializecomponent(); base.oninit(e); } /// <summary> /// required method designer support - not modify /// contents of method code editor. /// </summary> private void initializecomponent() { } #endregion } }
it gives error
server error in '/owc' application. not load file or assembly 'owc' or 1 of dependencies. attempt made load program incorrect format.
the error message means file owc.dll
or 1 of it's references missing.
check whether file either:
- in
bin
folder of web project (after publishing); - in gac (c:\windows\assembly).
if exist there, can use reflector, or similar products see references of owc.dll
, have check references too.
Comments
Post a Comment