OWC学习笔记-电子表格(Spreadsheet)第一个实例

        由于项目中决定使用OWC,主要使用电子表格对象模型图表工作区对象模型,现在将使用过程学习到的一些东西记录下来,以备后用。

电子表格对象模型(Spreadsheet ),看起来跟Excel就是孪生兄弟,初步使用并不困难。
先看看下面一个实例,是不是非常easy:

< html  xmlns:o ="urn:schemas-microsoft-com:office:office"
xmlns:x
="urn:schemas-microsoft-com:office:excel"
xmlns
="http://www.w3.org/TR/REC-html40" >

< head >
< meta  http-equiv =Content-Type  content ="text/html; charset=gb2312" >
< meta  name =ProgId  content =FrontPage.Editor.Document >
< meta  name =Generator  content ="Microsoft Excel 11" >
< title > Spreadsheet第一个实例 </ title >
</ head >

< script  language ="javascript"   >
    
function init() {

    Spreadsheet1.ActiveSheet.Cells.Clear();
    Spreadsheet1.ActiveSheet.Cells(
21).Value = "Car";
    Spreadsheet1.ActiveSheet.Cells(
31).Value = "Sport-Utility";
    Spreadsheet1.ActiveSheet.Cells(
41).Value = "Truck";
    Spreadsheet1.ActiveSheet.Cells(
51).Value = "Minivan";

    Spreadsheet1.ActiveSheet.Cells(
12).Value = "1998";
    Spreadsheet1.ActiveSheet.Cells(
22).Value = 0.2;
    Spreadsheet1.ActiveSheet.Cells(
32).Value = 0.06;
    Spreadsheet1.ActiveSheet.Cells(
42).Value = 0.17;
    Spreadsheet1.ActiveSheet.Cells(
52).Value = 0.13;

    Spreadsheet1.ActiveSheet.Cells(
13).Value = "1999";
    Spreadsheet1.ActiveSheet.Cells(
23).Value = 0.38;
    Spreadsheet1.ActiveSheet.Cells(
33).Value = 0.82;
    Spreadsheet1.ActiveSheet.Cells(
43).Value = 0.28;
    Spreadsheet1.ActiveSheet.Cells(
53).Value = 0.62;

    Spreadsheet1.ActiveSheet.Cells(
14).Value = "2000";
    Spreadsheet1.ActiveSheet.Cells(
24).Value = 0.42;
    Spreadsheet1.ActiveSheet.Cells(
34).Value = 0.12;
    Spreadsheet1.ActiveSheet.Cells(
44).Value = 0.55;
    Spreadsheet1.ActiveSheet.Cells(
54).Value = 0.25;

  }

  
</ script >

< body  onload ="init()" >


< b > Source:  </ b > 行业数据——汽车工业 < p >
< object  id =Spreadsheet1  classid =CLSID:0002E559-0000-0000-C000-000000000046  style ="width:100%;height:350" ></ object >
</ body >

</ html >

代码说明:

1.  要在html中使用电子表格对象,必须添加一个object对象,Spreadsheet 对象的编程标识符为 CLSID:0002E559-0000-0000-C000-000000000046(office2003版本,其他版本不同的clsid)

2. init方法是初始化电子表格内容。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农丁丁

你的认可是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值