簡體   English   中英

打開 XML 創建指向其他工作表的鏈接

[英]Open XML Create Link to other Worksheet

我很難找出 XML 在將一個工作表中的鏈接添加到另一個工作表時的樣子。 我想要這樣的東西:

MainSheet
    Cell    Cell    Cell
    data    data    LinkToSheet2
    data    data    LinkToSheet3
    data    data    LinkToSheet4

Sheet2
    Cell    Cell    Cell
    ... data ...
Sheet3
    Cell    Cell    Cell
    ... data ...    
Sheet4
    Cell    Cell    Cell
    ... data ...

我創建了一個空白 Excel 文件並添加到 Sheet1 A1 到 Sheet2 A1 的鏈接中,這是我得到的 XML:

<x:worksheet xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
  <x:dimension ref="A1" />
  <x:sheetViews>
    <x:sheetView tabSelected="1" workbookViewId="0" />
  </x:sheetViews>
  <x:sheetFormatPr defaultRowHeight="15" />
  <x:cols>
    <x:col min="1" max="1" width="19.5703125" customWidth="1" />
  </x:cols>
  <x:sheetData>
    <x:row r="1" spans="1:1">
      <x:c r="A1" s="1" t="s">
        <x:v>0</x:v>
      </x:c>
    </x:row>
  </x:sheetData>
  <x:hyperlinks>
    <x:hyperlink ref="A1" location="Sheet2!A1" display="LinkToWorkSheet2" />
  </x:hyperlinks>
  <x:pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3" />
  <x:pageSetup orientation="portrait" r:id="rId1" />
</x:worksheet>

您非常想注意<x:hyperlinks>元素:

<x:hyperlinks>
    <x:hyperlink ref="A1" location="Sheet2!A1" display="LinkToWorkSheet2" />
</x:hyperlinks>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM