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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Formatting select characters in cells

Thread ID:

Created:

Updated:

Platform:

Replies:

24579 Feb 7,2005 07:30 PM UTC Feb 9,2005 03:25 PM UTC WinForms 1
loading
Tags: XlsIO
Shannon Broskie
Asked On February 7, 2005 07:30 PM UTC

Hello, In the past, using automation I would sometimes need to format certain characters in a cell. Here''s an example of what I''m talking about written in Delphi using automation: ---- if Trim(dsCamra.FieldByName (''Tran_Type'').AsString) = ''BUY'' then ExcelWorksheet.Range [''A'' + IntToStr(intCurrentRow), ''A'' + IntToStr(intCurrentRow)].Value := ''WE HAVE PURCHASED THROUGH:'' ... if Trim(dsCamra.FieldByName (''Tran_Type'').AsString) = ''BUY'' then ExcelWorksheet.Range [''A'' + IntToStr(intCurrentRow), ''A'' + IntToStr(intCurrentRow)].Characters [9, 9].Font.Bold := True ----- As you can see, the word ''PURCHASED'' is set to bold. Is there a way to drill down to the characters level of a certain cell? If not, what would the best way be to do this? Would RichText be the answer? Thanks!

Administrator [Syncfusion]
Replied On February 9, 2005 03:25 PM UTC

Hi Shannon, Yes, you are correct in suggesting that RichText is the solution. Here is a sample code snippet IRange range = mySheet.Range["A1"]; range.Text = "Hello"; IRichTextString rtf = range.RichText; IFont font = myWorkbook.CreateFont(); font.Bold = true; font.Italic = true; font.RGBColor = Color.Red; rtf.SetFont( 2, 3, font ); However, there seems to be a bug in version 3.0 in applying the RichText.[It works fine in version 2.1.0.9]. We will fix it and post and update within the next few days. Could you please open a Direc-Trac incident regarding this. Thanks, Stephen. >Hello, >In the past, using automation I would sometimes need to format certain characters in a cell. Here''s an example of what I''m talking about written in Delphi using automation: >---- >if Trim(dsCamra.FieldByName (''Tran_Type'').AsString) = ''BUY'' then > ExcelWorksheet.Range [''A'' + IntToStr(intCurrentRow), > ''A'' + IntToStr(intCurrentRow)].Value := ''WE HAVE PURCHASED THROUGH:'' >... >if Trim(dsCamra.FieldByName (''Tran_Type'').AsString) = ''BUY'' then > ExcelWorksheet.Range [''A'' + IntToStr(intCurrentRow), > ''A'' + IntToStr(intCurrentRow)].Characters [9, 9].Font.Bold := True >----- >As you can see, the word ''PURCHASED'' is set to bold. > >Is there a way to drill down to the characters level of a certain cell? If not, what would the best way be to do this? Would RichText be the answer? > >Thanks!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;