单元格注释EPPLUS库的字符串格式

时间:2016-05-25 09:40:04

标签: .net excel epplus

使用EPPLUS创建 .xlsx 文件时是否可以格式化注释? 据我所知,唯一的方法是:
ExcelComment AddComment (字符串文字,字符串作者);

此库的评论是否还有其他已知限制?
如果是,那么在.net中有更好的选择吗?

1 个答案:

答案 0 :(得分:4)

事实证明我过早地决定EPPLUS受限制是错误的

评论格式

AddComment 方法创建了对象并返回它。这样您就可以使用 ExcelComment 中的 RichTextCollection 编辑对象

此示例将粗体放入单元格注释的一部分:

ExcelComment commento = wItem.AddComment(null, "Sys");
commento.RichText.RemoveAt(0);
ExcelRichText ert = commento.RichText.Add(dataItem.Commento[0]);
ert.Bold = true;
ert = commento.RichText.Add(dataItem.Commento[1]);
ert.Bold = false;


截断

至于截断,由于评论气泡的维度,它最初不可见。 examplecomment
使用的Autofit属性

wItem.Comment.AutoFit = true;