I am trying to port from VBA to .NET one of my old applications to transliterate the content of an Excel sheet to and from cyrillic codepage. For that I need to access the individual characters in each cell, as cells or parts of cells that are formatted in
italic must stay invariant in the process.
I am stuck with this (simplified) version of my code:
Excel.Range theRange = exlSheet.UsedRange;
int rowsCt = theRange.Rows.Count;
int colsCt = theRange.Columns.Count;
for (int iRow = 1; iRow <= rowsCt; iRow++)
for (int iCol = 1; iCol <= colCt; iKol++)
// this the current cell
theCell = theRange.Cells[iRow, iCol];
After this row I thought I intended to use the Characters object to loop through the individual characters in the cell, but this:
for (int iChar = 1; i <= theCell.Characters.Count; i++)
if (theCell.Characters[iChar, 1].Font.FontStyle = "Italic")
doesn't work, although it works in VBA code.
Visual Studio displays a red squiggly line with a tooltip text "Cannot apply indexing with  to an expression of type 'NetOffice.ExcelApi.Characters'".
I understand what the problem is, but I see no other way to work character by character in the cell.
I need that because I know no other way to find parts of cell content that are formatted in italic except to loop through the cell characters and note the beginnings and ends of the italic parts, and then transliterate only the parts that are not in italic.
I use NetOffice 1.0 with .NET Framework 3.5.
Thank you in advance for any help.