What is the difference between CellValues.InlineString and CellValues.String in OpenXML?

后端 未结 1 347
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 08:47

I am trying to write some code to generate an Excel spreadsheet and I am not sure what the difference between CellValues.InlineString and CellValues

1条回答
  •  我在风中等你
    2020-12-29 09:01

    According to the documentation at 18.18.11 ST_CellType:

    str (String) Cell containing a formula string.

    You will only want to use the CellValues.String when you are inserting a formula in the cell. Here is how the XML should look:

    
       CUBEVALUE("xlextdat9 Adventure Works",C$5,$A6)
       2838512.355
    
    

    CellValues.InlineString should only be used if you don't want to store the string in the SharedStringTable. Then anything you mark as an inlineString will be treated as rich text. Although note that when you use CellValues.InlineString that your text must be surounded by a text element and tag:

    
       test string
    
    

    0 讨论(0)
提交回复
热议问题