Programming Microsoft Office Web Components Chapter I of the first section

Source: Internet
Author: User
Tags filter bind include object model ole sort touch olap cube
What is the second section of the Web Components Office Web?

The Office Web components is a group of COM controls designed to provide interactive spreadsheet modeling, data reporting, and data visualization for numerous control containers. The OWC library contains four main components: a Spreadsheet Component, a Chart component, a pivot table component, and a data source component. We'll briefly discuss each control in this section and then discuss more details in the following chapters.



Comments:

COM is also called ActiveX. When Microsoft invented the term "ActiveX" to describe COM technology, I was in the Visual Basic group, a term that surprised most of our customers because they were just getting used to the term COM after we stopped using the term "OLE". I am not a marketing person, so in this book I use only the term COM to describe the Component Object Model technology.



The word "office" in the name "Office Web components" means that these controls were developed by a subset of the programmers who developed Microsoft Excel and access, and those controls were designed to look, Use feelings and behaviors like a streamlined version of their Microsoft Office brother. These controls do not contain all of the features in Excel and Access--in other words, you do not dynamically download the full Excel and access! to view a report in a browser However, these controls do contain a number of common features, especially those that are necessary to interact with existing content. In addition, the controls are able to read and write Excel 2000 HTML-formatted files, allowing users to click on a button to load the current data into Excel for more robust analysis. In this book, I'll describe in detail the salient features of Excel and access that are supported and unsupported by each component. Also shows you how to use your own code to add some of the features that are missing from these controls.





The "Web" section of the OWC name is often misleading. These controls are standard COM controls and can be used in a number of control containers, such as Microsoft Internet Explorer, Microsoft Visual Basic, Microsoft Visual C + +, Microsoft Visual FoxPro, and Microsoft Office user forms. However, some of the actions of these controls make them especially suitable for use in special environments of Internet Explorer. For example, a Web browser provides automatic scroll bars for documents, but people often fret about controls with a set of scroll bars in the page. spreadsheet controls and pivot controls can be set to automatically resize to fit their current content without the need for an internal scroll bar. In addition, all controls support the color names available in Internet Explorer, as well as digital RGB values. This means that you can use the "Cornsilk" or "papayawhip" (my personal hobby) element to set the background color, and the control will convert colors to the appropriate RGB values, as Internet Explorer does.

The "components" part of the OWC name is much more accurate than the word "Controls" (although I would call OWC "Controls" for convenience in this book), it is quite confusing. The difference with Office Web Components is that they can be used in containers like Web pages, Visual basic forms, and so on, as well as in memory, like invisible objects. Most COM controls can only be used as visual controls in the control container, and most objects that are not visible, such as those accessed through the Microsoft ADO Interface, can only be used in memory and cannot be placed on a form or Web page. The purpose of the OWC library design is to be used in any one way. This enables you to use these controls through their exposed user interfaces or to use the various background services of these controls, such as the recalculation of spreadsheets. This ability to use invisible objects also enables you to use these libraries on the server to easily generate static content that can be viewed in any Web browser (more on this in the end of this chapter).



All controls support a rich set of programming interfaces that can be in Microsoft VBScript (Visual Basic Script version), Microsoft JScript, Microsoft VBA (Visual Basic for application), java,c++ And any other language that can invoke a dual COM interface or dispatch COM interface. This means that you can add these components to a custom solution and design their appearance and behavior to suit your needs. I'll discuss most of these components ' important properties, methods, and events in a later section, and in these chapters, I'll cover the vast majority of these important content by telling a variety of solutions that can be found on the CD that is attached to this book.



See

If you are looking for an authoritative guide to COM technology, I recommend that you read the understanding ActiveX and OLE (Microsoft press,1996) book by David Chappell.



Let's take a look at each component and discuss what types of solutions we can use to build them. As mentioned before, the next four chapters will discuss each control in more depth.



Spreadsheet Component

The Spreadsheet component (shown in Figure 1-1), like a compact version of an Excel spreadsheet, consists of a spreadsheet user interface and a recalculation engine that supports almost all of the computing functions in Excel 2000. With this control, you can change and recalculate values, sort, filter, and scroll data, protect cells from modification, and even reload the data into Excel 2000 for further processing. A spreadsheet control can load data from an incoming parameter or from any URL to an Excel spreadsheet file that points to an HTML format.






Figure 1-1 Spreadsheet Component



Spreadsheet controls are useful when you want to create a valid spreadsheet model on the intranet so that others can modify input values and immediately see the results of a recalculation. Examples include mortgage calculator and reimbursement schedule model, product balance model, and sales forecast form.

This control is also useful for any type of crosstab or tabular data entry, especially if you need to use a formula that has an automatic calculation function. Examples include cost statements, event tables, and budget reports.

A spreadsheet control can bind cells to properties on other objects on a page, and then automatically update the cells and other cells associated with the cell when the data source indicates that the property value has changed. This allows real-time data, such as stock portfolios, to be provided in a spreadsheet for certain environments.



To achieve even when you edit other formulas in a spreadsheet that you are working on, or if you are formatting for another cell, the spreadsheet can continue to monitor new data and recalculate, and the spreadsheet controls are designed specifically.



Chart components

The Chart component (shown in Figure 1-2) is a compact version of an Excel chart that supports most two-dimensional chart types in Excel2000, such as Polar chart types. Another important feature of the Chart component is the ability to display multiple graphics immediately, allowing you to create a small, multiple design--in other words, a series of graphs that vary from one attribute to the next. A chart can be data-bound with a spreadsheet control, a PivotTable control, or an ADO Recordset object, or it will be populated with raw data. When you bind to a data source, the chart control is updated whenever the data source changes.



See

For more information about the power of small, multiple designs, see Edward Tufte's book Envisioning Information (Graphics Press, 1990).








Figure 1-2 Chart components



When you need to use diagrams to represent dynamic data or to monitor elements that are important to your business. The chart control can be quite useful. Because it provides a rich programming model, you can also use this control to add a number of effects to your diagram. For example, scale and move to the maximum extent of an axis, change the contents of the chart dynamically in the application depending on the mouse position, or have the user double-click a link to go to a new page that displays more information about the selected data point.



Pivot component

The pivot component, shown in Figure 1-3, is designed to provide interactive data reporting and analysis capabilities that provide all the functionality and various external data types for Excel PivotTables. It can extract data from tables and relational databases through OLE DB, and it can extract data from OLAP server's cube and cube files for OLAP. With this control, you can group, slice, and sort data in a variety of ways, creating graceful reports and interactive analysis on Dynamic Data.



Although it works best for data reporting and data analysis solutions, you can use this control in a number of tasks, and when bound to an OLAP cube, the pivot control provides a flexible, efficient analysis interface to the user. It organizations can concentrate on collecting and collating data based on their company's understanding of the data and loading the data into the cube, while the users who manipulate the control can slice the data according to their own needs.






Figure 1-3 Pivot Table



A PivotTable report can also do the same work directly on a relational database, so you can use this control even if you don't have an investment on an OLAP system. However, the performance of using OLAP data sources is always much faster, because of the nature of the technology. There are other logical benefits to OLAP, which we will discuss in depth in the seventh chapter, when we discuss sales analysis and report resolution.



Data Source Components

Data source components (DSC) are the backbone of a control that needs to obtain data from an external data source. Although this control is not visible, it is widely used to get and process data from hierarchies (terms in OLAP) or temporary OLAP cubes (detailed in chapter fourth), and to establish data associations among a variety of controls. Since the data source component supports the same standard interface as those of Internet Explorer and other data source controls in Visual Basic, it can interoperate in these environments. The data source component is used extensively in Access2000 data access page features and integrates features from many access report engines.



Almost all of the data source components are used when other components are getting data from an external database. However, it also supports a programming model of its own that you can use to create or manipulate hierarchical Recordset objects. In general, you do not need to think too much about data source controls, because other components and the ACCESS2000 Data access page Designer will set and invoke it for you.



Question: 1, the "components" part of OWC ' s name is a touch confusing how to translate this sentence?

2. The PivotTable component (shown in Figure 1-3) provides "All" functionality found in Excel PivotTables and External da How to translate the external data ranges in TA ranges?





Appendix: Original English

What Are The Office Web components?

The Office Web components are a set of Component Object Model (COM) controls designed to bring interactive mod Eling, database reporting, and data visualization to a number of the control containers. The OWC library contains four principal components:spreadsheet, Chart, PivotTable, and Data Source. We ' ll discuss each of these controls briefly in the, and in the very much detail in the following chapters.

Note


--------------------------------------------------------------------------------

COM is also known as ActiveX. I was in the Visual Basic team when Microsoft invented the term "ActiveX" to describe the COM technologies, throwing most Our my 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 into this book to describe the Component Object Model technolog ies. (Throw...for a loop: surprised)

The word "office" in the name "Office Web Components" indicates this controls were developed by some of the same progr Ammers who created Microsoft Excel and Microsoft Access and then the controls were made to look, feel, and behave like SMA ll versions of their Microsoft Office siblings. These controls definitely don ' t have all features found in Excel and access-in other words, you wouldn ' t want to Dynam ically download all of Excel and Access to view a on 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, 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 to add some of this missing features with your own codE.

The "Web" part of OWC ' s name is often misleading. The controls are standard COM controls and can is used in many control containers such as Microsoft Internet Explorer, Mic Rosoft 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 P Age to have its own set of scroll bars. The spreadsheet and PivotTable controls can is set to automatically adjust themselves to fit their current content without requiring internal scroll bars. Also, all of the controls support the color names available in Internet Explorer in addition to supporting numeric RGB values . That means can set the background color of ' an element to ' cornsilk ' or ' papayawhip ' (my personal favorite), and the CO Ntrol'll 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" (Thou GH I'll often refer to OWC as "controls" for convenience throughout this book). The Office Web components are unusual in this they can be used into control containers like Web pages, Visual Basic forms, a nd so on, as as and as in memory as invisible objects. Most COM controls can is used only as visible controls into control containers, and Most invisible objects, such as those AC Cessed via the Microsoft ActiveX Data Objects (ADO) interface, can is used only in memory and cannot is put on a form or W EB page. The OWC library is built so it components could be used either the way which User interfaces they expose or for their base services, such as spreadsheet recalculation. The ability to use the components as invisible objects also enables your to-use in 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 this can call from Microsoft VBScript (Visual Basic SCRI Pting Edition), Microsoft JScript, Microsoft VBA (Visual Basic for applications), Java, C + +, and any other language capabl E of calling a dual or dispatch COM interface. That means your can weave the components into a custom solution and make them look and act the way your want. I'll discuss most of the important properties, methods, and events in the subsequent chapters and'll cover many more O F the chapters describing the various solutions found on the companion CD.

ALSO


--------------------------------------------------------------------------------

If you are are looking for a definitive reference on COM, I ' d recommend picking up a copy of David Chappell ' s understanding Ac Tivex and OLE (Microsoft Press, 1996).

Let's take a brief look at the components and discuss what kinds of solutions for you can builds with them. As already mentioned, the next four chapters would cover each component at more depth.

The spreadsheet Component

The Spreadsheet component (shown in Figure 1-1) are like a small version of a Excel spreadsheet, complete with a spreadshe ET user interface and a recalculation engine that supports nearly all of the calculation 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 further manipulation. The spreadsheet control can-load its data ' embedded parameter ' and ' any URL ' points to an EXCEL spreadsheet s aved in HTML file format.


Figure 1-1. The Spreadsheet component.

The spreadsheet control are useful anytime you want to make a spreadsheet model available on your intranet and so that others C A 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 mod El.

This was also useful for any kind the cross-tabulated or grid-based data entry, especially when you need to use form Ulas 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 up The date the cell and its dependents when the source indicates this property value has changed. This is makes it possible to feeds real-time data into the spreadsheet for scenarios as a-stock such.

The spreadsheet control are specifically designed to keep listening for new values and recalculating even when you are edit ing other formulas or formatting, cells in the spreadsheet you ' re working on.

The Chart Component

The Chart component (shown in Figure 1-2) are comparable to a small version of Excel charting, supporting most of the two-d Imensional chart types in Excel as as as a Polar chart type. Another big feature is this Chart control can display many plots in once, allowing you to create a small-multiple desi Gn-in other words, a collection of plots that vary by one and can is 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 fil LED with literal data values. When bound to a data source, a Chart control would update whenever the source data changes.

ALSO


--------------------------------------------------------------------------------

For more information on the power of Small-multiple designs, from Edward Tufte ' book Envisioning Information (Graphics Pre SS, 1990).


Figure 1-2. The Chart component.

The Chart control are primarily useful any time for you need to Chart live data or monitor a specific metric to critical B Usiness. 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 t He functionality found in Excel PivotTables and external data ranges. It can retrieve data from tabular, relational databases through OLE DB, as as is as a from OLAP server cubes and cube files T Hrough OLE DB for OLAP. Using This control, can view data grouped, sliced, and sorted in a variety of ways, creating polished reports and inte Ractive analysis on live data.

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 to cubes that reflect the way their company th Inks about the "data, while the users working with the" control can create slices of the "the" 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 and can use it even if Y ou don ' t have an investment on OLAP system. However, the performance when using a OLAP data source is always much faster because of the "nature of the" technology. OLAP has other logical benefits "we'll discuss further when we explore" Sales analysis and Reporting solution in Ch Apter 7.

The Data Source Component

The Data Source component (DSC) is the "backbone for controls" require data from external sources. Although this control is invisible, it are 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. Since the DSC supports the same standard interfaces as other data source controls found in Internet Explorer and Visual Ba SIC, it would interoperate in those environments. The "DSC is used heavily in Access" Data Access pages feature and encapsulates much of the functionality in the Access reporting engine.

The DSC is involved almost the ' other components ' retrieve data from a external database. However, it also supports a programming model of its own, and the can use it to build or manipulate hierarchical Recordset Objects. In general, you don ' t need to how much about the DSC since the other components and the access Page Des Igner'll set it up and implement it for you.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.