使用Perl扫描/读取内部Excel xml文件app.xml

时间:2018-06-27 13:20:09

标签: xml excel perl

我正在读取Excel文件(扩展名为.xlsx)的内容,该文件是zip文件中包含的XML文件的集合。

我正在尝试使用Perl读取其中一些内部XML文件。我尝试读取的基本app.xml文件如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
  <Application>Microsoft Excel</Application>
  <DocSecurity>0</DocSecurity>
  <ScaleCrop>false</ScaleCrop>
  <HeadingPairs>
    <vt:vector size="4" baseType="variant">
      <vt:variant>
        <vt:lpstr>Worksheets</vt:lpstr>
      </vt:variant>
      <vt:variant>
        <vt:i4>4</vt:i4>
      </vt:variant>
      <vt:variant>
        <vt:lpstr>Named Ranges</vt:lpstr>
      </vt:variant>
      <vt:variant>
        <vt:i4>2</vt:i4>
      </vt:variant>
    </vt:vector>
  </HeadingPairs>
  <TitlesOfParts>
    <vt:vector size="6" baseType="lpstr">
      <vt:lpstr>Sheet1</vt:lpstr>
      <vt:lpstr>Sheet2</vt:lpstr>
      <vt:lpstr>Sheet3</vt:lpstr>
      <vt:lpstr>Sheet4</vt:lpstr>
      <vt:lpstr>Sheet3</vt:lpstr>
      <vt:lpstr>Test1</vt:lpstr>
    </vt:vector>
  </TitlesOfParts>
  <Company/>
  <LinksUpToDate>false</LinksUpToDate>
  <SharedDoc>false</SharedDoc>
  <HyperlinksChanged>false</HyperlinksChanged>
  <AppVersion>16.0300</AppVersion>
</Properties>

<HeadingPairs>部分包含两个部分

  • Excel文件中的所有非隐藏工作表
  • 所有命名范围

我需要更改一些工作表名称值,并且需要知道是否 Worksheets元素的HeadingPairs子节将始终在任意Excel文件中始终排在第一位。

如果不是总是如此,那么我有问题。我通常无法扫描它,因为我处理多种语言的Excel文件,并且每种语言的单词Worksheets都会被翻译。

我一直在寻找app.xml文件的结构或架构文档,但没有找到任何有用的信息。

0 个答案:

没有答案