Excel 2007 Open XML文件结构~~~1

Excel 2007 Open XML文件结构(1)

下面通过对如图20-1所示的工作簿文件进行剖析,以使读者深入地了解Excel 2007 Open XML文件的结构。

115842889.jpg 
图20-1  Excel 2007工作簿

Excel 2007 Open XML文件其实是一个zip文件。为了分析其结构,需要将其解压出来。因此,计算机系统中需要安装管理zip文件的软件(例如WinZip、WinRar等)。下面列出具体的步骤:

(1)将工作簿文件名"测试Excel2007文件结构.xlsx"的后面添加一个".zip"扩展名,修改为"测试Excel2007文件结构.xlsx.zip"。

(2)接着当弹出如图20-2所示的警告信息,单击【是】按钮,完成文件名的修改。

(3)将上步更名的文件解压,得到如图20-3所示的文件目录结构。

115904365.jpg 
图20-2  警告信息
115928596.jpg 
(点击查看大图)图20-3  解压后的文件结构

(4)在解压后的文件夹中,最重要的文件是文件夹xl中的workbook.xml文件,该文件的代码如下:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild=
"4505" />
<workbookPr defaultThemeVersion="124226" />
- <bookViews>
<workbookView xWindow="480" yWindow="15" windowWidth="8670" window
Height="5070" />
</bookViews>
- <sheets>
<sheet name="工作表1" sheetId="1" r:id="rId1" />
<sheet name="工作表2" sheetId="2" r:id="rId2" />
<sheet name="Sheet3" sheetId="3" r:id="rId3" />
</sheets>
<calcPr calcId="125725" />
</workbook>

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild=
"4505" />
<workbookPr defaultThemeVersion="124226" />
- <bookViews>
<workbookView xWindow="480" yWindow="15" windowWidth="8670" window
Height="5070" />
</bookViews>
- <sheets>
<sheet name="工作表1" sheetId="1" r:id="rId1" />
<sheet name="工作表2" sheetId="2" r:id="rId2" />
<sheet name="Sheet3" sheetId="3" r:id="rId3" />
</sheets>
<calcPr calcId="125725" />
</workbook>

workbook.xml文件包含一对<sheets>标签,其中的每个<sheet>元素都代表Excel 2007文件中的一个,工作表的名称就是其name属性的值,在上面的代码中,分别有3个工作表,即工作表1、工作表2和工作表3。<sheet>元素中r:id属性的值指出保存工作表数据的XML文件。

(5)打开"xl/_rels/workbook.xml.rels"文件,其内容如下所示:  

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/ relationships">
<Relationship Id="rId3"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet3.xml" />
<Relationship Id="rId2"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet2.xml" />
<Relationship Id="rId1"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet1.xml" />
<Relationship Id="rId6"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/sharedStrings"
Target="sharedStrings.xml" />
<Relationship Id="rId5"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/styles"
Target="styles.xml" />
<Relationship Id="rId4"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/theme"
Target="theme/theme1.xml" />
</Relationships>

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/ relationships">
<Relationship Id="rId3"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet3.xml" />
<Relationship Id="rId2"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet2.xml" />
<Relationship Id="rId1"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/worksheet"
Target="worksheets/sheet1.xml" />
<Relationship Id="rId6"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/sharedStrings"
Target="sharedStrings.xml" />
<Relationship Id="rId5"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/styles"
Target="styles.xml" />
<Relationship Id="rId4"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationsh- ips/theme"
Target="theme/theme1.xml" />
</Relationships>

转载于:https://www.cnblogs.com/blue-skies/archive/2010/07/09/1774545.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值