我有一个包含多个分号的字符串。在
'firstline: abc \n secondline: bcd \n thirdline: efg'
我想用下面的Xlsx Writer在excel单元格中写这个字符串。在
第一行:abc
第二行:bcd
第三行:efg
我就是这么做的。在
^{pr2}$
这是我在excel单元格中得到的结果:
bold , "firstline:" , "abc" ,bold , "secondline:" , "bcd" ,bold , "thirdline:" , "efg"
Tags:
jmcnamara的解决方案很有效。我发布了一个类似的可能的解决方案,但动态的。在
我希望这会有帮助
^{} 方法接受列表作为参数,但传递的是字符串。在
您应该使用类似的方法传递字符串和格式列表:
但是,如果您还希望文本换行,则需要在列表末尾添加
^{pr2}$text_wrap
单元格格式,并在希望换行的位置添加换行符。像这样:输出:
相关问题 更多 >
编程相关推荐