“office web components”名称中的单词”office”表示这些控件就是由那些开发微软excel和access的程序员中的一部分人开发的,并且这些控件被设计成在外观,使用感受和行为表现上就像是他们的微软office兄弟的精简版一样。这些控件确实不包含excel和access中的所有的功能——换句话说,您也不会为了在浏览器中查看一个报表而动态的下载完整的excel和access!然而,这些控件也确实包含了许多的常用功能,尤其是那些在与已有内容进行交互时所必需的功能。此外,这些控件还能够读写excel 2000的html格式的文件,允许用户点击一个按钮,将当前的数据加载到excel中,以便作更加强大的分析。本书中,我会详细描述这些被每个组件支持和不支持的excel和access的显著特性。也会向您展示如何利用自己的代码来添加一些这些控件所缺少的功能。
owc名称中的”components”部分虽然比使用单词”controls”要准确的多(尽管在这本书中我会为了方便将owc称为”controls”),但是也令人相当迷惑。office web components的与众不同之处在于,他们能够在类似web页面,visual basic窗体等等控件容器中使用,也能象不可视对象那样在内存中被使用。大部分的com控件只能在控件容器中被用作可视控件,而大部分的不可视对象,例如那些通过微软ado接口访问的对象,只能在内存中使用而不能放在窗体或web页面中。owc库设计的目的是可以通过任何一种方式来使用。这使得您能够通过它们暴露的用户界面来使用这些控件或者使用这些控件的各种后台服务,例如电子表格的重新计算功能。这种能够以不可见对象的方式来使用的能力,也使您能够在服务器上用这些库方便地生成可以在任何web浏览器中查看的静态内容 (在这一章的后面会更多的讲到这方面的内容)。
所有控件都支持一组丰富的编程接口,这些接口能够在微软vbscript(visual basic的脚本版本),微软jscript,微软vba(visual basic for application),java,c++以及任何其它能够调用双com接口或调度com接口的语言中调用。这意味这您可以将这些组件添加到定制的解决方案中,并根据您的需要设计它们的外观和行为。我将在后续章节中讨论这些组件大部分的重要属性,方法和事件,并在这些章节中通过讲述各种解决方案来讲述这些重要内容中的绝大部分,这些解决方案可以在本书附赠的cd中找到。
参见
如果您正在寻找关于com技术的权威的指南,我建议您选读david chappell的《understanding activex and ole(microsoft press,1996)》一书。
疑问:1、the "components" part of owc's name is a touch confusing这句如何翻译?
2、the pivottable component (shown in figure 1-3) provides all the functionality found in excel pivottables and external data ranges.中的external data ranges如何翻译?
附录:英文原文
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.
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. (throw…for a loop:大吃一惊)
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 wouldn'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, web 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 numeric 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 applications), 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.
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, filter, 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.
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.