What Are the Office Web Components?
The Office Web Components are a set of Component Object Model (COM) controls designed to bring interactive spreadsheet modeling, database reporting, and data visualization to a number of control containers. The OWC library contains four principal components: Spreadsheet, Chart, PivotTable, and Data Source. We'll discuss each of these controls briefly in this section and in much more detail in the following chapters.
NOTE
COM is also known as ActiveX. I was on the Visual Basic team when Microsoft invented the term "ActiveX" to describe the COM technologies, throwing most of our customers for a loop since they had just gotten used to saying COM after we stopped using the term "OLE." Since I'm not a marketing person, I'll just use the term COM in this book to describe the Component Object Model technologies.
The word "Office" in the name "Office Web Components" indicates that the controls were developed by some of the same programmers who created Microsoft Excel and Microsoft Access and that the controls were made to look, feel, and behave like small versions of their Microsoft Office siblings. These controls definitely don't have all the features found in Excel and Access—in other words, you wo
uldn't want to dynamically download all of Excel and Access to view a report in your browser! However, the controls do contain many of the commonly used features, especially those needed when interacting with content that's already been created. Plus, they can read and write the HTML file format of Excel 2000, allowing the user to click a button and load the current data into Excel for more powerful analysis. In this book, I'll detail the noteworthy Excel or Access features that are and aren't supported by each component. I'll also show you how to add some of these missing features with your own code.
The "Web" part of OWC's name is often misleading. The controls are standard COM controls and can be used in many control containers such as Microsoft Internet Explorer, Microsoft Visual Basic, Microsoft Visual C++, Microsoft Visual FoxPro, or Microsoft Office UserForms. However, the controls have a few behaviors that make them especially suited to the unique environment of Internet Explorer. For example,
visual basic pdfweb browsers automatically support scrolling along a document, and it's often annoying for a control in the page to have its own set of scroll bars. The Spreadsheet and PivotTable controls can be set to automatically adjust themselves to fit their current content without requiring internal scroll bars. Also, all the controls support the color names available in Internet Explorer in addition to supporting numeri
c RGB values. That means you can set the background color of an element to "CornSilk" or "PapayaWhip" (my personal favorite), and the control will convert the color to the appropriate RGB value just as Internet Explorer would.
The "Components" part of OWC's name is a touch confusing, although it's more accurate than using the word "Controls" (though I will often refer to OWC as "controls" for convenience throughout this book). The Office Web Components are unusual in that they can be used in control containers like web pages, Visual Basic forms, and so on, as well as in memory as invisible objects. Most COM controls can be used only as visible controls in control containers, and most invisible objects, such as those accessed via the Microsoft ActiveX Data Objects (ADO) interface, can be used only in memory and cannot be put on a form or web page. The OWC library was built so that its components could be used either way, which enables you to use the controls with the user interfaces they expose or for their base services, such as spreadsheet recalculation. The ability to use the components as invisible objects also enables you to use the library on a server to easily generate static content that users can view in any web browser (more on that later in the chapter).
All the controls support a rich set of programming interfaces that you can call from Microsoft VBScript (Visual Basic Scripting Edition), Microsoft JScript, Microsoft VBA (Visual Basic for Applicatio
ns), Java, C++, and any other language capable of calling a dual or dispatch COM interface. That means you can weave the components into a custom solution and make them look and act the way you want. I will discuss most of the important properties, methods, and events in the subsequent chapters and will cover many more of these in the chapters describing the various solutions found on the companion CD.
SEE ALSO
If you are looking for a definitive reference on COM, I'd recommend picking up a copy of David Chappell's Understanding ActiveX and OLE (Microsoft Press, 1996).
Let's take a brief look at each of the components and discuss what kinds of solutions you can build with them. As already mentioned, the next four chapters will cover each component in more depth.
The Spreadsheet Component
The Spreadsheet component (shown in Figure 1-1) is like a small version of an Excel spreadsheet, complete with a spreadsheet user interface and a recalculation engine that supports nearly all the calculation functions in Excel 2000. With this control, you can change or recalculate values; sort, filte
r, and scroll data; protect cells; and even reload the data into Excel 2000 for further manipulation. The Spreadsheet control can load its data from an embedded parameter or from any URL that points to an Excel spreadsheet saved in HTML file format.
Figure 1-1.The Spreadsheet component.
The Spreadsheet control is useful anytime you want to make a spreadsheet model available on your intranet so that others can change the input and instantly view the recalculated results. Examples include a mortgage calculator and payment schedule model, a product break-even model, and a sales forecasting model.
This control is also useful for any kind of cross-tabulated or grid-based data entry, especially when you need to use formulas with automatic recalculation. Examples include expense reports, timesheets, and budgets.
The Spreadsheet control has the ability to bind cells to properties of other objects on the page and then automatically update the cell and its dependents when the source indicates that the property value has changed. This makes it possible to feed real-time data into the spreadsheet for scenarios such as a stock portfolio.
The Spreadsheet control is specifically designed to keep listening for new values and recalculating even when you are editing other formulas or formatting other cells in the spreadsheet you're working on.
The Chart Component
The Chart component (shown in Figure 1-2) is comparable to a small version of Excel charting, supporting most of the two-dimensional chart types in Excel 2000 as well as a Polar chart type. Another big feature is that the Chart control can display many plots at once, allowing you to create a small-multiple design—in other words, a collection of plots that vary by one property and can be compared at a glance. A chart can be data-bound to the Spreadsheet control, the PivotTable control, or an ADO Recordset object, or it can be filled with literal data values. When bound to a data source, a Chart control will update whenever the source data changes.
SEE ALSO
For more information on the power of small-multiple designs, see Edward Tufte's book Envisioning Information (Graphics Press, 1990).
Figure 1-2.The Chart component.
The Chart control is primarily useful any time you need to chart live data or monitor a specific metric critical to your business. Because it supports a rich programming model, you can also add many effects to a chart with this control, such as zooming and panning on large axes, dynamically changing other content in the application based on the mouse's location, or letting users double-click to link to a new page displaying more information about the selected data point.
The PivotTable Component
Designed to deliver interactive data reporting and analysis, the PivotTable component (shown in Figure 1-3) provides all the functionality found in Excel PivotTables and external data ranges. It can retrieve data from tabular, relational databases through OLE DB, as well as from OLAP server cubes and cube files through OLE DB for OLAP. Using this control, you can view data grouped, sliced, and sorted in a variety of ways, creating polished reports and interactive analysis on live data.
You can use this control for many tasks, although it's best suited for database reporting and data analysis solutions. When bound to an OLAP cube, the PivotTable control can provide the user with a flexible, high-performing analysis surface. IT groups can concentrate on collecting and cleaning data and loading it into cubes that
reflect the way their company thinks about the data, while users working with this control can create slices of the data to fit their own needs.
Figure 1-3.The PivotTable component.
The PivotTable control can also perform the same operations directly on a relational database, so you can use it even if you don't have an investment in an OLAP system. However, the performance when using an OLAP data source is always much faster because of the nature of the technology. OLAP has other logical benefits that we'll discuss further when we explore the Sales Analysis and Reporting solution in Chapter 7.
The Data Source Component
The Data Source component (DSC) is the backbone for controls that require data from external sources. Although this control is invisible, it is widely used to retrieve data, manipulate data into hierarchies or temporary OLAP cubes (more on this in Chapter 4), and establish data bindings between the various controls. Since the DSC supports the same standard interfaces as other data source controls found in Internet Explorer and Visual Basic, it will interoperate in those environments. The DSC is used heavily in Access 2000's data access pages feature and encapsulates much of the
functionality found in the Access reporting engine.
The DSC is involved almost any time the other components retrieve data from an external database. However, it also supports a programming model of its own, and you can use it to build or manipulate hierarchical Recordset objects. In general, you don't need to think much about the DSC since the other components and the Access 2000 Data Access Page Designer will set it up and implement it for you.

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。