如何使用closedxml在同一个excel单元格中制作不同颜色的文本 [英] How to make different colors of texts in same excel cell using closedxml

查看:371
本文介绍了如何使用closedxml在同一个excel单元格中制作不同颜色的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用closedXML在同一个excel单元格中制作不同颜色的文本





ClosedXML没有像我在下面尝试的那样请帮我在同一个单元格中制作2种不同的字体颜色



我尝试了什么:



worksheet.Cell(1,1).Value.Character [StartIndex,NoOfChar] .Font.Color .... ??

How to make different colors of texts in same excel cell using closedXML


ClosedXML doesn't have something like I tried below please help me to make 2 different font colors in same cell

What I have tried:

worksheet.Cell(1,1).Value.Character[StartIndex, NoOfChar].Font.Color....??

推荐答案

我自己找到了解决方案

使用RichText来设置单元格的不同部分,例如:

I found the solution by my self
Use RichText to style different parts of the cell, for example:
worksheet.Cell(1,1).RichText.Substring(StartIndex, NoOfChar).SetFontColor(XLColor.Red);



请参阅 [文档]了解更多详情。


See the [documentation] for more details.


这篇关于如何使用closedxml在同一个excel单元格中制作不同颜色的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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