The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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!
ADAdministrator Syncfusion Team 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!