We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Access and format single characters of a cell

Hi,

does XlsIO offer the functionality to access and format single charcters of a Range like this is possible in MS Excel by Range.Characters() (Range.get_Characters() when using Interop assemblies)? I did not find the corresponding function in XlsIO.

We urgently need this feature as we have to set different fonts for different characters within one cell string.

Thanks in advance & best regards
Christian

3 Replies

MW Melba Winshia Syncfusion Team September 5, 2007 12:17 PM UTC

Hi Christian,

Thank you for your interest in Essential XlsIO.

You can format single character of a Range by using IRange.RichText property. But we do not have any similar API Range.Characters() as in MS Excel. If your intention is to get characters of a Range, it can be achieved by using IRange.Text.ToCharArray() method. Please use the below code snippet to set different fonts for different characters within one cell string.

[C#]

//Insert Rich Text
IRange range = sheet.Range["A1"];
range.Text = "RichText";
IRichTextString rtf = range.RichText;

//Formatting first 4 characters
IFont redFont = workbook.CreateFont();
redFont.Bold = true;
redFont.Italic = true;
redFont.RGBColor = Color.FromArgb(0xde, 0x64, 0x13);
rtf.SetFont( 0, 3, redFont );

Please refer to the samples that are shipped with Essential XlsIO to get more details regarding this issue that is found in below location.

C:\Documents and Settings\melbas\My Documents\Syncfusion\EssentialStudio\5.1.0.51\Windows\XlsIO.Windows\Samples\2.0\Rich Text\WriteRichText\cs

Please try this and let me know if this helps.

Thanks,
Melba


CN Christian Nein September 10, 2007 01:36 PM UTC

Hi Melba,

this works great! Thank you very much for supporting.

Best regards
Christian


MW Melba Winshia Syncfusion Team October 17, 2007 08:36 AM UTC

Hi Christian,

Thank you for the update.

Glad to hear that it works fine.

Please let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon