Hi All,
I'have a problem testing the value of Strikeout Attribute on a SubString of a single cell.
Actually i'm using Aspose.Cells.dll Version 4.9.1.0 but i noticed that this is a common problem on all version of aspose.
I tried to save the excel file with different version of excel but the result is the same.
I wrote this example in order to show the problem and i attached an Example Excel file.
private void button1_Click(object sender, EventArgs e)
{
Int32 idxStart = 0, idxEnd = 0, i = 0;
int NumStrikeOutFound = 0, r = 0, c = 0;
String str;
Aspose.Cells.Worksheet xlSheet;
Aspose.Cells.Workbook xlBook = new Aspose.Cells.Workbook();
String NomeFileXls = "C:\\Users\\enrico\\Desktop\\butta\\test3.xlsx";
xlBook.Open(NomeFileXls);
xlSheet = xlBook.Worksheets[xlBook.Worksheets.ActiveSheetIndex];
while (i < xlSheet.Cells[r, c].StringValue.Length)
{
// Write on debug window the value of StrikeOut of each single characters
str = "Pos {0}, Char {1}, Strikeout {2}";
Debug.Print(str, i, xlSheet.Cells[r, c].StringValue.Substring(i,1), xlSheet.Cells[r, c].Characters(i, 1).Font.IsStrikeout);
str = xlSheet.Cells[r, c].StringValue.Substring(i, 1);
if (str == ";")
{
idxEnd = i - 1;
str = xlSheet.Cells[r, c].StringValue.Substring(idxStart, idxEnd - idxStart + 1);
// Test my token
if (xlSheet.Cells[r, c].Characters(idxStart, idxEnd - idxStart + 1).Font.IsStrikeout)
{
NumStrikeOutFound++;
Debug.Print ("Token is : " + str + " and Is Strikeout");
}
else
Debug.Print ("Token is : " + str + " and Is NOT Strikeout");
idxStart = i + 1;
}
i += 1;
}
}
The Result is:
Pos 0, Char p, Strikeout True
Pos 1, Char i, Strikeout True
Pos 2, Char p, Strikeout True
Pos 3, Char p, Strikeout True
Pos 4, Char o, Strikeout True
Pos 5, Char ;, Strikeout True
Token is : pippo and Is Strikeout
Pos 6, Char p, Strikeout True
Pos 7, Char l, Strikeout True
Pos 8, Char u, Strikeout True
Pos 9, Char t, Strikeout True
Pos 10, Char o, Strikeout True
Pos 11, Char @, Strikeout True
Pos 12, Char ;, Strikeout True
Token is : pluto@ and Is Strikeout
Pos 13, Char p, Strikeout True
Pos 14, Char a, Strikeout True
Pos 15, Char p, Strikeout True
Pos 16, Char e, Strikeout True
Pos 17, Char r, Strikeout True
Pos 18, Char i, Strikeout True
Pos 19, Char n, Strikeout True
Pos 20, Char o, Strikeout True
Pos 21, Char @, Strikeout True
Pos 22, Char ;, Strikeout True
Token is : paperino@ and Is Strikeout