Implementing office Web component extends tables with ASP. NET

Source: Internet
Author: User
ArticleDirectory
    • Technical Architecture
    • Providing data access with ADO. NET and ADODB
    • Binding to the data
    • Control Versions
    • Security and trusted level
    • Office licensing considerations

Implementing office Web component extends tables with ASP. NET By Eric charranintroduction

A short time after Office 2000 debuted, please developers began to recognize the power of Office Web Components. during the time of their initial release, they were known as the hour and chart components. these client-side controls served as a method for extending the specified table and pie chart components of EXCEL to the Internet environment.

originally designed for an Intranet environment, these Web Components allowed users to work with dynamic data from various data sources inside a control in Internet Explorer. users were able to create their own reports using interactive drill up/down capabilities, and to supplement this information with charting. with the introduction of SQL Server 2000's analysis services, which built on SQL Server 7.0's OLAP services, microsoft Excel and the Drawing Chart and drawing Web controls became the premier tool for exploiting multi-dimen1_data within OLAP cubes.

Subsequently, when Office XP was introduced, the keys and chart components underwent significant functionality upgrades, including advances to the user interface as well as reliability. these controls represent a low-cost method of deploying advanced reporting functionality in a quick and efficient manner. however, the methods used to produce these reports (I. E ., saving a weekly report or pie chart as a Web page using Microsoft Excel, or Microsoft Access) require the user of the report to have direct connectivity to the data source.

Implementing these components in a true internet environment (external internet users via a DMZ or Internet-exposed server ), or an environment where users do not have direct connectivity to the data source can be accomplished through ASP. net. essential tially The method involves placing the Web component on a web form or user control and passing it a specially formatted XML document for its data set in real time.

Technical Architecture

The architecture of the solution provided des a simple ASP. net web form which possesses a user control. the user control contains a Microsoft Office charts or chart control. depending on the development environment, several iterations of the control might be available. the versions of these controls will depend on the versions of Microsoft Office installed on the local machine (I. E ., microsoft Office chart 11.0, 10.0, 9.0 ). these version numbers correspond with the build numbers of office.

To use the specified table or pie chart Web component, the control (s) must be added to the toolbox. the controls can be found as a [COM components] object and be added using the [add \ remove items…] Menu from the Toolbox context menu. once the control has been added, it can be dragged on to the web form or user control. this action places an <Object> tag representing the specified table control into the HTML.

  

One interesting element about the specified table and chart object is the ability to change the version of the object depending on the classid attribute. changing the classid to correspond to the version of the specified control desired is an easy way of changing compatibility to accommodate clients.

For use in a previous ate environment with security requirements, options for deployment include deploying the ASP. NET application to an IIS Site that uses HTTPS encryption as well as integrated security. users will have to navigate to the site under SSL and provide account information before being granted access to the specified application. furthermore, the application can include functionality to segment reports via the specified controls by user credentials supplied to IIS by users.

Additionally, for a truly disconnected data solution (I. E ., clients do not have direct access to the data source), a control that supplements the grants or chart control must be present. the presence of the data source control will serve as the facilitator that binds together the adodb xml and the tables or chart control.

The following example extends strates the HTML code that represents the data source. this code can be placed in. aspx or. ascx HTML without using the Visual Studio IDE. this component is required for the aforementioned solution.

<Object ID = DSC classid = CLSID: 0002e530-0000-0000-c000-
000000000046 viewastext> <Param name = "xmldata" value ='
<XML xmlns: A = "urn: Schemas-
Microsoft-com: Office: Access ">&# 13; & #10;
<A: performancecontrol >&# 13; & #10;
<A: owcversion> 9.0.0.3821
</A: owcversion> & amp; #13; & amp; #10;
<A: maxrecords> 0 </a: maxrecords >&# 13; & #10;
<A: gridx> 24 </a: gridx> & amp; #13; & amp; #10;
<A: gridy> 24 </a: gridy >&# 13; & #10;
<A: datamodel version = "0816"> & amp; #13; & amp; #10;
</A: datamodel >&# 13; & #10;
</A: performancecontrol >&# 13; & #10; </XML> '> </Object>
Development methodologyproviding data access with ADO. NET and ADODB

A key component in rendering the data is to use the ADODB Object Library. this is the fastest method of producing the formatted XML that the Web Components CT. in a typical scenario, developers may create a reporting portal, in which all of the data driven menus and HTML is rendered from SQL Server using ADO. net, while a separate class responsible for providing into table or chart data will implement ADODB by adding a project reference to the library through the IDE. the ADODB. streamxml method will take an ADODB recordset and stream it to a file as formatted XML.

This file can reside in a virtual directory on the server which can be accessed by the web form or user control rendering the Office Web component to the user. again, access to this data will be accomplished through client side scripting.

Binding to the data

once the cursor or chart control has been added to the ASP. NET development environment, the remaining tasks are to provide the control with data. the control depends on processing ing a formatted XML result set which is conducive to multiple axes of the Office Web component. since the Office Web component runs client side, the data must be rendered from the server (populated by ASP. net via code behind techniques) and sent to the client's browser.

This arrangement is necessary to deliver this solution to a truly disconnected set of users (I. E ., DMZ or Internet users), who do not have direct access to the data source. to facilitate this, the web form or user control which houses the Office Web component must contain client side scripting (VB script or Javascript) which understands the presence of the XML data and then binds it to the role control. furthermore, the same client script shocould also bind the measures found in the XML data to the partition or chart object so the user does not see a blank weekly report or chart that the user has to build manually.

The following sample written in VB script indicates the methodology to bind XML data from the ADODB stream to the client side into table control.

<Script language = VBScript> sub window_onload pspace. displayfieldlist = true dim DC set Dc = DSC. constants DSC. recordsetdefs. addnew "supportfiles/pivotdata. XML ", DC. dsccommandfile, "dscdata" pspace. datasource = DSC pspace. datamember = "dscdata" DSC. connectionstring = "provider = mspersist.1" pspace. commandtext = "effectdata. XML "End sub </SCRIPT>

This example extends strates that when the web form is loaded and the client side VB Script window_onload sub fires, the data is retrieved from the Web server using the redorsetdefs. addnew method of the data source control, and is bound to the specified table.

In the above example, the specified table control (pspace), is bound to the data source control (DSC ). the first step of the script is to obtain a reference to the data source control. subsequently, the control is bound to the XML file generated by the application (I. E ., A code-behind class which connects to the database using ADODB and creates a file in real-time ). this newly produced XML file is housed within the application's virtual directory and is accessible to the page. the file is read into the data source control. the script then binds this control to the specified table's. datasource property.

The script also ensures that the control's Field List is displayed so users can easily see the list of fields available in the data set once the specified table control is bound.

Deploymentcontrol versions

One important note about the deployment architecture is that Clients visiting the page with the specified object may not have the control installed. office XP's Web Components and Office 2003 does a nice job of providing native information for the user to download and install the component. if the Office 2000 version of the specified control (version 9.0 of the chart or custom object), must be used due to client requirements, it is important to arrange for the pre-configuration of the clients before visiting the page. this may involve ensuring the client base already has an install of the Office 2000 web hosting and chart components (commonly installed with Office 2000 ).

Security and trusted level

Additionally, when users browse the page, one of the features common to all web components is the ability to export information from the control into excel. this is accomplished through a toolbar button within the control. this button launches excel on the clients 'machine and transfers the data in the same or chart control to excel. users may encounter some security communications courtesy of Internet Explorer which relate to accessing data processing SS domains. if the user selects to allow this, the export to Excel functionality of the control will function normally. in order to avoid this warning, users shoshould ensure that the site with the control (s) is registered with their browser's list of trusted sites. once the site is trusted, most security messages with regard to the control will be suppressed.

Office licensing considerations

It is important to note that while Office 2000 users can download and install Office XP and Office 2003 Web Components and view reports, much of the advanced functionality of the control is disabled. this includes des the ability to export the control data to excel. microsoft requires that users of the controls have an actual license for Office XP or Office 2003 to enable the control's full functionality. if Office 2000 users visit an Office XP or Office 2003 Web component, the control disables much of the advanced functionality and only allows the users a base-level of control interactivity (I. E ., the ability interact with the control and its data ). most of the context menus and toolbar buttons will be disabled unless the control determines that the user has the corresponding version of Office.

--

Eric charranIs currently working as a technical effecect and web developer, in Horsham Pa. eric holds Microsoft certifications in SQL Server and has significant experience in planning, designing, and modeling N-tier applications using SQL Server 2000, as well as loading Ting and implementing. net Framework based applications, solutions and Web services. eric's other professional skills encompass database administration, data warehousing and application architecture, modeling and design, as well as data warehouse transformation and population using DTs. eric is also skilled in developing and implementing ASP. net and Windows Forms applications, using technologies such as COM +,. net Framework, VB. net and other. net ages.


Contributors : Eric charran
Last Modified Am details about using ADODB and creates a file in Real-Time Posted Gabriel elh At PM hello Eric, I try to use your architecture for connect a Microsoft Analysis Service cube with a temporary control in a disconnected environment.
I need some additionals details about create a XML file from cube data.
I don't see any examples that use ADODB. streamxml METHOD IN THE 2.7 version. What version of the library you use?
In adition, I have a doubt; this method write all the existing data in the cube into a XML file?

I appreciate all the info that you can send my.

Thanks a lot,
Gabriel elreplies to this comment details about using ADODB and creates a file in real-time (Posted Mougue AtAm) datasource for External table using C #Posted Lpeens AtAm I am in need of desperate help. I am very new with Web components. I want to know how you can specify the datasource for a temporary table using C # and SQL Server. if someone can give me an example using the northwind database on SQL.

Please help !!

Lizelle

Replies to this comment datasource for your table using C #( Posted Mougue At ) Dataconnection on server side ( Posted Lpeens At Am) Source ( Posted Dslaby At Am) datasource for External table using C #( Posted I _am_blue At Am) Please send me the code ....( Posted Dgupta At Am) XML structure Posted Lpeens At Am hi there again,

Cocould you show me an example of how the XML page looks like that you link? And how do you specify what you want to display in the page, or does that not matter with the specified table?

Thank you

Lizelle

Connecting XML to export tTable Posted Dinnoc At Am hi,
This is exactly what I want to do. I have created the XML on the server but cannot get the same table to look at it. cocould you possibly send me the source code for the whole page.

Regards

James

Help with the following table Posted Francisco At PM hi, I am a newbie in this, I am currently working with owc11, Asp.net 2.0, VB.net, SQL Server 2005, ado.net, master pages and Data Access Application Block from patterns and practices. I created an XML document from a dataset with the writexml method but it did not work, I am also having problems with the VBScript, I do not know what to do, I tried this sample with some of my da Ta. For security reasons I do not want to expose the database connection on the client-side script, so the solution with XML file is fine to me. What I am doing wrong?

Thank you in advice.
Francisco

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.