哪里可以使用这些组件?
既然office web components都是com控件,您会很自然的希望它们能够在任何自称是com控件容器的环境中工作。然而,理论和现实不总是一致的,尤其在软件世界里。微软公司创造了许多能够包含控件的环境(我们小组脱口就能说出了16个),而别的公司创造了许多其它的环境。
为了避免office的测试小组发狂,我们针对不同的容器,进行不同的级别的office web components测试。首先,我们挑选出那些我们认为人们使用的最多的容器,进行了充分的测试。然后,我们在不常使用的容器中进行了基本的和特别的测试。最后,我们将一些容器组织起来,形成了一个”没有经过正式的测试,但是当使用时不会产生灾难性后果”的范围。表1-1显示了这个范围中的容器。
表 1-1. 经过测试的容器.
container
test coverage
microsoft internet explorer 5.0
full
microsoft internet explorer 4.01
full
microsoft internet explorer 3.x
not supported
microsoft visual basic 6.0
full
microsoft visual basic 5.0
basic
microsoft visual interdev
basic
microsoft access forms
basic
microsoft office userforms
basic
microsoft frontpage 99
full
microsoft frontpage 98
basic
microsoft access 2000 data access page designer
full
microsoft script editor
full
microsoft word 2000
basic
microsoft excel 2000
basic
microsoft powerpoint 2000
basic
microsoft outlook 2000
basic
microsoft visual c++/mfc projects
none
microsoft visual j++
none
还有,要注意在不同的容器中,控件的设计时行为很不相同。因为office web components是相当复杂的控件,常常需要在控件内部选择元素(例如电子表格中的单元,数据透视报表中的透视字段,或图表中的一系列数据点),以及格式化或处理这些元素。为了能够实现这个功能,在允许控件界面激活的容器中,控件会界面激活,这意味着这些控件会响应鼠标和键盘事件。在设计模式中针对控件所做的任何修改,都会在运行期间重载控件时和文档或窗体一起被保留,这就使得控件在被重置时显得和您保存它们时完全一样。一些容器在您点击控件时立刻使控件界面激活。而另一些容器则要求双击控件。还有其它的一些容器要求您通过两次单击来激活这些控件。这些行为完全由容器所决定。因此请参考容器的文档,以了解容器如何在设计阶段处理com控件。
请注意上述这些并不会影响控件运行期间的行为。在运行期间,所有的容器在加载了控件之后就会使控件界面激活。但是一些环境,例如office文档,因为您总是在编辑当前加载的文档,所以永远也不会进入运行状态。而internet exlporer,visual basic,visual c++,access forms和office用户界面都具有运行时模式,期间控件会立刻被激活。
数据存取页和internet explorer 5
如果您阅读任何access2000的文档,您很可能看到一些声明,告诉您只能在internet explorer5或更高版本中浏览数据存取页。虽然这是真的,但是这个声明一般并不适用于office web components。这些组件可以在internet explorer 4.01及以上版本中使用,然而它们不能在任何较早版本中使用(4.0,3.x,2.x等等)。这个版本要求也适用于任何使用excel2000创建的交互内容(创建过程使用office web components),也适用于使用这些组件开发出的定制解决方案。数据存取页需要internet explorer5中一些特殊的特性,这就是为什么它们只能在这个环境中运行。然而,office web components本身可以很好的在上面所列的那些经过测试的容器中使用。
在服务器上使用office web components
前文提到过,office web components即能够以控件的形式驻留在窗体,文档或网页中,也可以以无用户界面的对象的形式驻留在内存中。每个控件都提供一个属性或者方法以返回控件当前内容的静态表现形式。图表和数据透视表控件可以创建它们内容的gif图形,而电子表格控件可以返回一个html的表格片断或者一个完整地页面,这个片断或者页面可以在任何与html3.2兼容的浏览器中显示。所有这些都意味这您可以在web服务器上使用这些控件,实现服务器端的图表图形和数据透视报表的生成,或实现服务器端的电子表格模型重算功能。我会在本书第二部分演示一些这类技巧。
除了讨论如何在服务器上使用这些控件之外,我们也会在本书后部考察许多更精细的问题,例如性能,可伸缩性和可靠性。
部 署
基于web的解决方案最具吸引力的方面之一就是不需要应用程序的显示安装。需要做的事情要么是以脚本的形式在页面中编程,要么是以applets或者com控件的形式自动下载。office web components通过使用internet explorer的codebase特征,可以实现无需安装的部署和自动的更新机制。这些组件也包括一个成熟的web安装工具,使得下载的过程十分有意思。还有,owc在技术上并不依赖于office 2000,因此它能够和office97环境并存,也能在没有安装任何office软件的机器上使用。
在第12章会涉及到关于部署任务的各方面,以及如何建立自动部署owc的解决方案。
netscape navigator怎么样?
当我在讨论会和其它一些用户聚会上讲述office web components时,总有人问这个问题:“这些组件可以在netscape navigator中运行吗?”答案是明确的“不行,”但是,这里有一些需要说明的地方。
netscape navigator 4.5本身并不支持com控件,因此如果没有安装任何插件,office web components甚至不能被netscape navigaotor加载。然而,一个名为ncompass labs的公司为netscape navigator开发了一个控件,使得netscape navigator可以在web页面中控制com控件。那么,如果您安装了这个插件,您就能够在netscape navigator中使用这些组件了吗?答案是“看情况”,这里又有一些需要说明的。
您可能使用owc建立许多包含了组件间通讯的解决方案――例如,绑定到一个数据透视表或者电子表格上的图表,或是绑定到页面上其它元素属性上的一个电子表格单元。这些解决方案需要internet explorer提供的功能的支持。而即使是安装了ncompass插件的netscape navigator也不能提供这些功能,因此这些解决方案完全不能在netscape navigator中工作。
使用单个的组件或是使用相互间不通讯的多个组件的解决方案,是可能在netscape navigator中成功运行的。然而,这是我们的测试小组没有研究的容器之一,因此我不能保证它会成功。
您应该还记得,无论如何,由服务器上的控件产生的静态内容可以在netscape navigator和internet explorer中显示。因此如果您的运行环境需要支持两个浏览器,您可能会对在web server上使用这些组件的方法以及展示了实现这些功能的技术的解决方案感兴趣。
附录:英文原文
where can you use the components?
since the office web components are com controls, you'd naturally expect them to work in any environment that called itself a com control container. however, theory and reality don't always match up, especially in the world of software. microsoft makes many environments that can contain controls (16 that our team could recall off the top of our heads), and various other companies create many others.
to keep the office test team from going mad, we tested the office web components at different levels in different containers. first, we picked the containers we thought people would use most and performed full test passes on them. we then performed basic, ad hoc testing on the containers used less often. and finally, we grouped a few containers into the "not formally tested but doesn't cause a nuclear meltdown when tried" category. table 1-1 shows which containers fell into what category.
table 1-1. tested containers.
container
test coverage
microsoft internet explorer 5.0
full
microsoft internet explorer 4.01
full
microsoft internet explorer 3.x
not supported
microsoft visual basic 6.0
full
microsoft visual basic 5.0
basic
microsoft visual interdev
basic
microsoft access forms
basic
microsoft office userforms
basic
microsoft frontpage 99
full
microsoft frontpage 98
basic
microsoft access 2000 data access page designer
full
microsoft script editor
full
microsoft word 2000
basic
microsoft excel 2000
basic
microsoft powerpoint 2000
basic
microsoft outlook 2000
basic
microsoft visual c++/mfc projects
none
microsoft visual j++
none
also note that the design-time activation of the controls varies quite a bit from container to container. since the office web components are fairly complex controls, it is often necessary to select elements within a control (such as a cell in a spreadsheet, a pivot field in a pivottable report, or a series of data points in a chart) and format or perform operations on them. to enable this functionality, the controls will become ui active in containers that allow this, meaning they will respond to mouse and keyboard events. any changes made to the controls in design mode will persist with the document or form when it is reloaded at runtime, resetting the controls to look exactly as they did when you saved them. some containers make the controls ui active as soon as you click them. others require that you double-click the control before it becomes ui active. still other containers require you to single-click them twice to activate them. this behavior is entirely determined by the container, so refer to the container's documentation to see how it deals with com controls at design time.
note that this does not affect a control's runtime behavior. at runtime, all containers make the controls ui active after loading them. but some environments, such as office documents, never get into a runtime state because you are always editing the document that's currently loaded. internet explorer, visual basic, visual c++, access forms, and office userforms all have a runtime mode in which the controls are immediately active.
data access pages and internet explorer 5
if you read any of the access 2000 documentation, you will likely see statements that say you can view data access pages only in internet explorer version 5 and above. although true, that statement does not apply to the office web components in general. the components will function in internet explorer 4.01 and above, though they won't function in any earlier versions (4.0, 3.x, 2.x, and so on). this applies to any interactive content created with excel 2000 (which uses the office web components) and to custom solutions developed using the components.
data access pages rely on a few specific features in internet explorer 5, which is why they only run in that environment. however, the office web components themselves can run quite happily in the tested containers listed earlier.
using the office web components on a server
as mentioned before, the office web components were designed to run both as controls "sited" within a form, document, or web page, and as objects in memory with no user interface. each of the controls exposes a property or method that returns a static representation of its current content. the chart and pivottable controls can create gif images of their content, and the spreadsheet control can return an html table fragment or full page that can be rendered by any browser that's compatible with html 3.2. all of this means you can use the components on a web server to perform server-side generation of chart images and pivottable reports or server-side recalculation of a spreadsheet model. i'll demonstrate a few of these techniques in part ii of the book.
besides discussing the how-to of using the components on the server, we'll examine a number of more subtle issues related to performance, scalability, and reliability later in the book.
deployment
one of the more attractive aspects of web-based solutions is that they don't require explicit setup of an application. anything needed is either included with the web page in the form of scripts or is automatically downloaded as applets or com controls. the office web components enable a no-install deployment and automatic upgrade mechanism by using the codebase feature of internet explorer. the components also include a sophisticated web installing control that makes the download experience much more attractive. furthermore, owc has no technological dependency on office 2000, so it can coexist in an office 97 environment or be used on a machine that doesn't have any other part of office installed.
i'll cover all the aspects of deployment and how you can build your solutions to automatically deploy owc in chapter 12.
what about netscape navigator?
when i talk about the office web components at conferences or other customer gatherings, invariably someone asks the question, "do these run in netscape navigator?" the answer is essentially "no," but it has a few caveats.
netscape navigator 4.5 does not natively support com controls, so without any plug-ins, the office web components won't even be loaded by netscape navigator. however, a company called ncompass labs, inc. makes a plug-in for netscape navigator that can host com controls in a web page. so if you installed this plug-in, could you use the components in netscape navigator? the answer is "it depends" and, again, has a few caveats.
many solutions you might build with owc involve communication between the components—for instance, a chart bound to a pivottable or spreadsheet, or a spreadsheet cell bound to the property of another element on the page. these solutions depend on functionality provided in internet explorer that isn't present in netscape navigator even with the ncompass plug-in, so they simply won't work in netscape navigator.
using a single component or multiple components that do not communicate with one another is possible in netscape navigator. however, this is one of the containers that our test team did not research, so i can't guarantee that it will work.
you should always remember, however, that static content generated by the controls on the server can be rendered in either netscape navigator or internet explorer. so if your runtime environment requires that you support both browsers, you probably will be more interested in using the components on your web server and in the solutions that show the techniques that do so.
网站运营seo文章大全提供全面的站长运营经验及seo技术!