GemBox Spreadsheet:一个单元格中的多种字体颜色

我使用GemBox Spreadsheet导出数据,我需要格式化单元格中的文本以获得多种颜色。

在Excel中这是可能的(在StackOverflow上find):

Dim fixedLength As Long fixedLength = Len("Employee") ActiveCell.FormulaR1C1 = "Employee Some Employee" With ActiveCell.Characters(Start:=fixedLength + 2, Length:=Len(ActiveCell) - FixedLength - 1).Font .Color = vbRed End With 

然而,我可以在GemBox类中find的是设置Style.Font.Color属性,这将影响整个单元格。 例:

 for (int i = 0; i < tempArray.GetUpperBound(0); i++) { Color backColour = ColorTranslator.FromHtml(tempArray[i+1]); ws.Cells[row, col].Value += tempArray[i] + Environment.NewLine; ws.Cells[row, col].Style.Font.Color = backColour; i++; } 

GemBox可以吗?

用于.NET4.0的GemBox Spreadsheet Professional 3.5

v4.0.30319

v35.3.40.1000

我知道这个问题很老,但几年前我通过电子邮件向开发人员询问。 他们说这是不可用的。

如果您直接通过电子邮件发送,他们通常会在一个工作日内回复 我想他们是在捷克共和国。

您可以在这里打开支持票: http : //www.gemboxsoftware.com/support-center/new-ticket? newticket[ticket][department_id]=1&newticket[ticket][product_id] =1

在同一页面上还有一个反馈选项卡,您可以build议他们将其添加为function,其他开发者可以对要添加的function进行投票。

当前版本的GemBox.Spreadsheet(版本3.9)有一个API支持。 请参阅以下内联文本格式演示示例:

http://www.gemboxsoftware.com/SampleExplorer/Spreadsheet/BasicFeatures/InlineTextFormatting?tab=cs

总之你需要的是使用GetCharacters方法:

http://www.gemboxsoftware.com/spreadsheet/help/html/Overload_GemBox_Spreadsheet_AbstractRange_GetCharacters.htm

此方法返回单元格文本中的一系列字符,然后可以根据需要进行格式设置。