到现在之接触了Word2007与Excel2007的xml更改个别属性的问题。
无论是docx或者xlsx的扩展名都可以直接将其改为.zip,并解压出来。解压出来的文件除了在printersettings下有个bin文件以外,其他是xml文件。

1、Word2007产生的文件夹word下存在一个document.xml文件,可以通过对该文件进行操作赋值来达到改变word文档内容的效果。
2、Word2007中可以嵌套Excel表格(假设现在的Excel为2007的版本),解压以后这些表格存在于word/embeddings文件夹下。并且是以Excel文件的形式存在,如果想要修改这些Excel文件的内容,那仍旧是将其解压。

3、Excel2007产生的文件夹xl下存在一个sharedStrings.xml文件,该文件存储单元格中的内容,但并不是所有的内容都存在于该文件中。在worksheets文件夹下的sheet.xml(sheet文件不止一个,对应于Excel文件中的工作簿名称)中

OpenXml——Office2007<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
OpenXml——Office2007
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
OpenXml——Office2007  
<dimension ref="A1:M33" />
OpenXml——Office2007  
<sheetViews>
OpenXml——Office2007    
<sheetView showGridLines="0" tabSelected="1" workbookViewId="0">
OpenXml——Office2007      
<selection sqref="A1:E1" />
OpenXml——Office2007    
</sheetView>
OpenXml——Office2007  
</sheetViews>
OpenXml——Office2007  
<sheetFormatPr defaultRowHeight="13.5" />
OpenXml——Office2007  
<cols>
OpenXml——Office2007    
<col min="1" max="1" width="54.875" style="18" customWidth="1" />
OpenXml——Office2007    
<col min="2" max="2" width="1.625" customWidth="1" />
OpenXml——Office2007    
<col min="4" max="4" width="2" customWidth="1" />
OpenXml——Office2007    
<col min="5" max="5" width="16" customWidth="1" />
OpenXml——Office2007    
<col min="13" max="13" width="9" hidden="1" customWidth="1" />
OpenXml——Office2007  
</cols>
OpenXml——Office2007  
<sheetData>
OpenXml——Office2007    
<row r="1" spans="1:5" ht="14.25">
OpenXml——Office2007      
<r="A1" s="19" t="s">
OpenXml——Office2007        
<v>0</v>
OpenXml——Office2007      
</c>
OpenXml——Office2007      
<r="B1" s="19" />
OpenXml——Office2007      
<r="C1" s="19" />
OpenXml——Office2007      
<r="D1" s="19" />
OpenXml——Office2007      
<r="E1" s="19" />
OpenXml——Office2007    
</row>
OpenXml——Office2007    
<row r="2" spans="1:5" ht="15">
OpenXml——Office2007      
<r="A2" s="13" />
OpenXml——Office2007      
<r="B2" s="1" />
OpenXml——Office2007      
<r="C2" s="2" />
OpenXml——Office2007      
<r="D2" s="2" />
OpenXml——Office2007      
<r="E2" s="2" />
OpenXml——Office2007    
</row>
OpenXml——Office2007    
<row r="3" spans="1:5">
OpenXml——Office2007      
<r="A3" s="14" t="s">
OpenXml——Office2007        
<v>1</v>
OpenXml——Office2007      
</c>
OpenXml——Office2007      
<r="B3" s="3" />
OpenXml——Office2007      
<r="C3" s="4" t="s">
OpenXml——Office2007        
<v>2</v>
OpenXml——Office2007      
</c>
OpenXml——Office2007      
<r="D3" s="5" />
OpenXml——Office2007      
<r="E3" s="4" t="s">
OpenXml——Office2007        
<v>3</v>
OpenXml——Office2007      
</c>
OpenXml——Office2007    
</row>
OpenXml——Office2007  
</sheetData>
OpenXml——Office2007  
<mergeCells count="1">
OpenXml——Office2007    
<mergeCell ref="A1:E1" />
OpenXml——Office2007  
</mergeCells>
OpenXml——Office2007  
<phoneticPr fontId="1" type="noConversion" />
OpenXml——Office2007  
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3" />
OpenXml——Office2007  
<pageSetup paperSize="9" orientation="portrait" r:id="rId1" />
OpenXml——Office2007
</worksheet>
Cols节点下的col节点可以设置列宽。
row节点下的c节点,如果不存在t属性,则v节点中的值为该单元格的值,如果存在t属性,则v节点中的值对应于SharedStrings.xml文件中的索引。

相关文章:

  • 2021-08-18
  • 2021-10-02
  • 2021-07-11
  • 2021-09-14
  • 2021-06-28
  • 2022-12-23
  • 2021-07-16
  • 2021-08-15
猜你喜欢
  • 2021-10-28
  • 2021-11-30
  • 2021-08-21
  • 2021-12-03
  • 2021-11-08
  • 2021-07-21
  • 2022-02-08
相关资源
相似解决方案