OWCA Learning 1

Source: Internet
Author: User
At this stage, we are studying OWC. (Owc: Microsoft office web components component)
OWC consists of four parts: CharpSpace (chart), Spreadsheet (workbook), PivotTable, and another one that needs to be confirmed before writing.
The following describes the simple operation steps. I will write a sample while learning. Please kindly advise me! Thank you!
1. Introduce the OWC component. (Right-click the project name and select "add Reference..." from the drop-down menu... ", select" COM "in the pop-up interface, select" Microsoft Office web components11.0 ", and click" OK .), After completing the preceding steps, you can see "OWC11" under the project Reference.
2. Add "using Microsoft. Office. Interop. Owc11;" to the page ;";
3. Now you can add an object to the page. For example, Spreadsheet: <object id = "Spreadsheet1" classid = ""> </Object>. Of course, you can also create an object in the code Section: "Microsoft. office. interop. owc11.Spreadsheet dd = new Microsoft. office. interop. owc11.Spreadsheet (); (the usage has not been studied in the code .) ";
4. This step is written in js. It is just a preliminary form with data. Add a load () in js code, and add the following to load:
Spreadsheet1.Activesheet. Cells (). Value = "the first grid ";
Spreadsheet1.Activesheet. Cells (2, 1). Value = "second ";
Spreadsheet1.Activesheet. Cells (3, 1). Value = "third cell ";
Then add onload = "return load ()" to the body: <body onload = "return load ()">;
Generate.
The above is the simplest sample.
The overall code is as follows:
 

<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "Default. aspx. cs" Inherits = "WebApplication2. _ Default" %>

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head id = "Head1" runat = "server">

<Title> Untitled Page </title>

<Script language = "javascript">

Function onload (){

Alert ("start ");

 

Var Spreadsheet1 = document. all ("Spreadsheet1 ");

Alert (Spreadsheet1 );

Spreadsheet1.ActiveSheet. Cells (0.13). Value ="

Spreadsheet1.ActiveSheet. Cells (0.23). Value ="

Spreadsheet1.ActiveSheet. Cells (0.33). Value ="

Spreadsheet1.ActiveSheet. Cells (0.43). Value ="

Spreadsheet1.ActiveSheet. Cells (2.13). Value ="

Spreadsheet1.ActiveSheet. Cells (2.23). Value ="

Spreadsheet1.ActiveSheet. Cells (2.33). Value ="

Spreadsheet1.ActiveSheet. Cells (2.43). Value ="

Alert (Spreadsheet1.XMLData );

Alert ("End ");

}

</Script>

</Head>

<Body onload = "return onload ()">

<Form id = "form1" runat = "server">

<Div>

</Div>

</Form>

<OBJECT id = "Spreadsheet1" classid = "clsid: 0002E559-0000-0000-C000-000000000046" name = "Spreadsheet1" style = "width: 100%; height: 421px">

</OBJECT>

</Body>

</Html>

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.