使用spreadsheetml封装文本的样式 [英] Style for wrapped text with spreadsheetml

查看:516
本文介绍了使用spreadsheetml封装文本的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xslt生成我的电子表格,并且想要一个包含文本的单元格(或更好的是:一个带有换行符的文本)。

I generate my spreadsheet with xslt and want a cell with wrapped text (or better: a text with a line break in it).

所以我的xslt生成以下是sheetdata的XML:

So my xslt generates the following XML for the sheetdata:

<sheetData>
  <row r="1">
    <c r="A1" t="inlineStr">
      <is>
        <t>
          a simple string
          line break jeeeehaaa
        </t>
      </is>
    </c>
  </row>
</sheetData>

在完成了我的工作簿之后,我在Excel中打开它;没有换行符,只是A1中一个简单的单行字符串。

After I'm finished building my Workbook, I open it in Excel; and there's no line break, just a simple one-line string in A1.

有没有人可以解决这个问题?不必在xml或xslt(但会很好)。我也可以在c#中执行某些操作

has anyone a solution to this? Doesn't have to be in xml or xslt (but would be nice). I could also do some things in c#

推荐答案

在excel中,所有样式相关信息都存储在style.xml文件中。
因此,包装信息应该存储在style.xml中,样式ID应该在< cr =A1t =inlineStr> 作为一个属性的'(这意味着风格)。让我显示这个是什么意思..

In excel, all style related information is stored in style.xml file. So, the wrapping information should be stored in style.xml and the style Id should be referred in <c r="A1" t="inlineStr"> as one more attribute 's' (which means style). Let me show what do I mean by this..

我确实有一些excel与一些文本,细胞被包裹确实。

I do have an excel with some text and the cell is wrapped indeed.

如果我看到它的sheet.xml数据,它将在< c>中的 s =1属性值项标签。

If I see its sheet.xml data it would have s="1" attribute-value item in <c> tag.

所以,如果我打开style.xml并查看单元格样式信息,我会得到 cellXfs> 标签和< xf> 子标签,其中我得到一个< align> 标签与wrapText属性值为1(true的确)。

So, if I open style.xml and see the cell style info I'll get <cellXfs> tag and a <xf> child tag where I get a <alignment> tag with wrapText attribute with value as "1" ("true" indeed).

由于我是新来的,我无法发布图像。希望这有助于:)

I'm unable to post images since I'm new to SO. Hope this helps :)

这篇关于使用spreadsheetml封装文本的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆