在xlsx OOXML文件中向单元格添加文本?

twe*_*ypi 3 xml excel spreadsheet xlsx

我一直在查看excel生成的一些xml文件,并发现它定义了一个单元格的内容,它做了这样的事情:

<c r="ABC" t="s">
<t>1</t>
</c>
Run Code Online (Sandbox Code Playgroud)

其他地方引用sharedString.xml文件的位置.

所以我的问题是,是否可以将文本内容直接放在标签内?像这样:

<c>
<text>ABC</text>
</c>
Run Code Online (Sandbox Code Playgroud)

或者我是否总是需要引用外部共享字符串xml文件?

Skr*_*l29 5

其他地方引用sharedString.xml文件的位置.

它位于子文件"xl/sharedStrings.xml"中."t"元素内的值是"xl/sharedStrings.xml"中"si"元素的索引(第一个索引为0).

是否可以将文本内容直接放在标签内?

是的,像这样:

  <c r="ABC" t="inlineStr">
    <is>
      <t>Here is the text directly in the cell</t>
    </is>
  </c>
Run Code Online (Sandbox Code Playgroud)