OWC introduction

zhaozj2021-02-16  72

OWC introduction: Microsoft Office 2000 contains a set of new control collections called OWC. With these components, you can create many useful data analysis solutions with the report generated solutions in a web browser and other traditional programming environments.

Office Web Component is a set of Com (Component Object Model: Component Object Model) controls for providing interactive electronic data table models, database reports and data visualization services for multiple control containers.

The OWC library contains four main components: spreadsheet components, Chart (chart) components, PivotTable components, Data Source components.

The extraordinary of Office Web Components is that they can be used in control containers such as web pages, Visual Basic forms, or in memory as invisible objects. Most COM controls can only be used as visual controls in the control container, while most invisible objects can only be used in memory without placing in the form or in the web page. Components in the OWC library can be used in the above two ways, so that users can reference controls in an interface, or enable controls to provide basic services to them. The ability to use components in an invisible object can also be convenient to use this library on the server, making it easy to view static content on any web browser.

All controls in OWC support rich programming interface collections such that developers can call these controls through Microsoft VBScript, Microsoft JScript, Microsoft VBA, Java, C with any other language that can call two-way or fast COM interfaces.

Chart Components: The Chart component is a COM control created by developers created by the development of Chart in Microsoft Excel 2000. It can provide basic business chart production methods in two ways of the COM control on the screen with the GIF generating engine in memory.

In OWC9, the Chart control is supported in addition to all 2D chart types in Excel (except for the Contour type), the Polar type, Stacked PIE type, Filled Scatter type chart is supported. However, it does not contain support for any three-dimensional chart type or effect.

The version of Office Web Component provided by Office2000 is 9.0 (OWC9)

Office Web Component from OfficeXP is 10.0 (OWC10)

In the later series of tutorials, we use the Northwind database in SQL Server as an example, in-depth discussion to introduce MS OWC, and all examples can run directly.

We use an example to show the powerful function of OWC.

Chart.asp program.

<% OPTION Explicit%>

Use MS Office Web Component to create a boutique chart </ Title></p> <p><%</p> <p>Function ExportChartTogif (Objcspace, StrabsFilePath, StrrelFilePath)</p> <p>DIM STRFILENAME</p> <p>Randomize</p> <p>Strfilename = Timer & Res & ".gif"</p> <p>Objcspace.exportPicture StrabsFilePath & "& StrfileName," GIF ", 650, 400</p> <p>ExportChartTogif = StrrelFilePath & "& strfilename</p> <p>END FUNCTION</p> <p>Sub Cleanupgif (Gifpath) DIM OBJFS</p> <p>DIM Objfolder</p> <p>Dim GIF</p> <p>Set objfs = server.createObject ("scripting.filesystemObject")</p> <p>Set objfolder = objfs.getfolder (GIFPATH)</p> <p>For Each Gif in Objfolder.Files</p> <p>IF INSTR (GIF.NAME, ".gif")> 0 and datediff ("n", gif.datelastmodified, now)> 10 THEN</p> <p>Objfs.deletefile gifpath & "& gif.name, true</p> <p>END IF</p> <p>NEXT</p> <p>Set objfolder = Nothing</p> <p>Set objfs = Nothing</p> <p>End Sub</p> <p>%></p> <p></ HEAD></p> <p><Body bgcolor = "# ffffff"></p> <p><div align = "center"></p> <p><br></p> <p><br></p> <p><%</p> <p>Dim objChartspace</p> <p>Dim objChart</p> <p>Dim objSeries</p> <p>DIM Objconn</p> <p>DIM OBJRS</p> <p>DIM C</p> <p>DIM Series</p> <p>DIM STRCHARTABSPATH</p> <p>DIM STRCHARTRELPATH</p> <p>DIM STRCHARTFILE</p> <p>Dim Axis</p> <p>DIM FNT</p> <p>DIM AX</p> <p>Strchartabspath = Server.mappath (".")</p> <p>StrChartrelpath = Server.mappath (".")</p> <p>'Settings Components</p> <p>'Using OWC9, it is the Office 2000</p> <p>Set objChartSpace = Server.createObject ("Owc.chart.9")</p> <p>Set objchart = objchartspace.Charts.add</p> <p>SET C = ObjChartspace.Constants</p> <p>'Graphic border color</p> <p>ObjChart.Border.color = "red"</p> <p>'Displaying the histogram</p> <p>ObjChart.Type = 1</p> <p>Objchart.haslegegend = true 'Display legend</p> <p>Objchart.haastitle = true 'Show title</p> <p>Objchart.title.caption = "Use Office Web Component to create a boutique chart (www.orrfly.com Chinese technology website)"</p> <p>Set fnt = Objchart.title.font</p> <p>FNT.NAME = "Song"</p> <p>FNT.SIZE = 12</p> <p>FNT.BOLD = TRUE</p> <p>FNT.COLOR = "red"</p> <p>Set objconn = server.createObject ("adoDb.connection")</p> <p>Objconn.open "provider = sqloledb; data source = yang; initial catalog = northwind; user ID = sa; password ="</p> <p>Set objrs = server.createObject ("adoDb.recordset") set objrs.activeconnection = Objconn</p> <p>Objrs.cursortype = adopenStatic</p> <p>Objrs.cursorLocation = aduseclient</p> <p>'What is the quantity of each supply?</p> <p>Objrs.open "Select Count (ProductName) AS Col, CategoryName from Products, Categories WhereProducts.categoryId = Categories.categoryId Group by CategoryName</p> <p>Set objChartSpace.DataSource = ObJRS</p> <p>'Display legend content</p> <p>Objchart.SetData C.chdimseriesNames, 0, "categoryname"</p> <p>For Each ObjSeries in Objchart.seriescollection</p> <p>ObjSeries.SetData C.chdimcategories, 0, "categoryname"</p> <p>ObjSeries.SetData C.chdimvalues, 0, "col"</p> <p>NEXT</p> <p>SET AX = ObjChart.axes (C.CHAXISPSITIONBOTTOM)</p> <p>Ax.hastitle = TRUE</p> <p>Ax.title.caption = "Type"</p> <p>Set fnt = ax.title.font</p> <p>FNT.NAME = "Song"</p> <p>FNT.SIZE = 15</p> <p>FNT.BOLD = TRUE</p> <p>FNT.COLOR = "blue"</p> <p>SET AX = ObjChart.axes (C.chcategoryAxis)</p> <p>Ax.hastitle = TRUE</p> <p>Ax.title.caption = "Quantity"</p> <p>Set fnt = ax.title.font</p> <p>FNT.NAME = "Song"</p> <p>FNT.SIZE = 15</p> <p>FNT.BOLD = TRUE</p> <p>FNT.COLOR = "Green"</p> <p>Strchartfile = exportcharttogif (ObjchartAbspath, Strchartrelpath)</p> <p>Response.write "<img src =" "" & structfile & ""> & "<p>"</p> <p>Cleanupgif StRCHARTABSPATH</p> <p>Objrs.close</p> <p>Set objrs = Nothing</p> <p>Set objconn = Nothing</p> <p>Set objseries = Nothing</p> <p>Set objChart = Nothing</p> <p>Set objChartspace = Nothing</p> <p>%></p> <p></ div></p> <p></ Body></p> <p></ Html></p> <p>Precautions for using this component: 1. On the Offic2000's CD, there is an executable file of MSOWC.MSI .ok 2. It is recommended that you use Visual InterDev6.0 development, and the automatic prompt function of the code will play a great role.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-15166.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="15166" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.044</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'FSKKIBdYlX_2BHUkqxVe6bIKDKKnU9hEkdav7JUceXB8XPfcmr5OTnKS9yXwpaJiF84ab71MsvlCS4Mn5ly55fvw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>