0

I have some text in cells which are formatted in different ways, let's say: "This is mixed style within a single cell"

I can access the text content and IRange's Interior property provides color data (among others), and IRange also have Style property which provides Font data, which can tell if the text is bold or italic. In my case however I may have different styles within a single cell. How can I extract that?

Csaba Toth
  • 10,021
  • 5
  • 75
  • 121
  • In VBA you would examine the `Characters` property of the `Range` object. Is there something similar in `C#`? – Ron Rosenfeld Jul 31 '16 at 10:26
  • @RonRosenfeld Good point, there is a `GetCharacters`: http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/#SpreadsheetGear2012~SpreadsheetGear.IRange~GetCharacters.html I'll look at `ICharacters`. It maybe not too efficient to go character-by-character, but if it works then it's fine – Csaba Toth Jul 31 '16 at 21:01
  • `ICharacters` has a `Font` property, probably this gonna work. – Csaba Toth Jul 31 '16 at 21:03
  • I'm glad I was able to suggest a solution. – Ron Rosenfeld Jul 31 '16 at 21:04
  • @RonRosenfeld post your suggestion as answer and I'll accept it. – Csaba Toth Aug 06 '16 at 07:30

1 Answers1

1

In VBA you would examine the Characters property of the Range object. Is there something similar in C#?

Ron Rosenfeld
  • 53,870
  • 7
  • 28
  • 60
  • C# has `GetCharacters` on the `IRange`: http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/#SpreadsheetGear2012~SpreadsheetGear.IRange~GetCharacters.html. `ICharacters` has a `Font` property (http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/SpreadsheetGear2012~SpreadsheetGear.ICharacters_members.html) which can help with analyzing the format of any section of the content. – Csaba Toth Aug 07 '16 at 22:20