Strange behavior with Worksheet.Cells[-].Characters (Generating #N/A when text bolded)

BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH BLAHBLAH
BLAHBLAH BLAHBLAH blah blahblah 1234 #N/A #N/A #N/A #N/A
BLAHBLAH BLAHBLAH #N/A #N/A #N/A #N/A #N/A
BLAHBLAH BLAHBLAH #N/A #N/A #N/A #N/A #N/A

Above is a section of the a table created in Excel with Aspose Cells. I am trying to iterate through the table and add formatted text into each cell. The inner table (white/gray background) should have a line of normal text followed by a line of bolded text.

I am expecting to see "blah blahblah\n1234" filled in each of the cells on the inner table, and yet I get many #N/A values.

Removing the line:

worksheet.Cells[y, x].Characters(content.IndexOf("1"), 4).Font.IsBold= true;

causes all the boxes to be filled with the correct text (not #N/A), but as expected the bold formatting for the number disappears. I'd like to see all subtable cells filled with the correct text, bold in the right places. Any ideas? Source below.

Thanks

Jonathan

Relevent bit:

//I have tried this line with or without the \n

string content = "blah blahblah\n1234";

worksheet.Cells[y, x].PutValue(content);

//If I remove the following line, the cells are correctly filled, but not formatted.

worksheet.Cells[y, x].Characters(content.IndexOf("1"), 4).Font.IsBold= true;

Whole code of loop:

for (int y = 3; y < 44; y++)

{

for (int x = 1; x < 19; x++)

{

if (x == 1 || y == 3)

{

worksheet.Cells[y, x].PutValue("BLAHBLAH BLAHBLAH");

}

else

{

string content = "blah blahblah 1234";

worksheet.Cells[y, x].PutValue(content);

worksheet.Cells[y, x].Characters(content.IndexOf("1"), 4).Font.IsBold= true;

}

if (x == 1 && y == 3)

{

worksheet.Cells[y, x].PutValue("");

}

}

worksheet.Cells.SetRowHeightPixel(y, 80);

}

Could someone try this code on their Aspose.Cells and see if it is reproducible outside my environment please?

I tried your code but it worked fine in my place. It may be a bug in old version. Please try this attached version.

Worked like a charm. Thanks!