We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem on attribute IsStrikeout

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

Hi,
Thank you for using Aspose product.
We are looking in to this issue. We will get back to you as soon as we will find some solution.

Thanks,

Hi,

We have tried to reproduce the issue. We have tested it by using Aspose.Cells.ddl version 5.1.0.0 in VS2008. If the delimiter is a space not ";" then it worked fine else for some time it is working and for some time it is not. However, we have logged the issue into our internal issue tracking system. The issue id is CELLSNET-19033.

We will update you as soon as possible.

Thanks,

Hi,

Please change your codes as the following now:
static void Main(string[] args)
{
Workbook workbook = new Workbook(@"F:\FileTemp\test3.xlsx");
int idxStart = 0, idxEnd = 0, i = 0;
int NumStrikeOutFound = 0, r = 0, c = 0;
String str;

Worksheet xlSheet = workbook.Worksheets[0];
FontSetting[] fontSettings = xlSheet.Cells[r, c].GetCharacters();
string strValue = xlSheet.Cells[r, c].StringValue;

while (i < strValue.Length)
{
// Write on debug window the value of StrikeOut of each single characters
str = "Pos {0}, Char {1}, Strikeout {2}";
bool isStrikeoutkey = IsStrikeout(i,fontSettings);
Console.WriteLine(str, i,strValue[i], isStrikeoutkey);
if (isStrikeoutkey)
NumStrikeOutFound++;

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 (NumStrikeOutFound == str.Length + 1)
{
Console.WriteLine("Token is : " + str + " and Is Strikeout");
}
else
Console.WriteLine("Token is : " + str + " and Is NOT Strikeout");

idxStart = i + 1;
}
i += 1;
}
workbook.Save(@"F:\FileTemp\dest.xlsx");
}
internal static bool IsStrikeout(int i, FontSetting[] fontSettings)
{
for (int nn = 0; nn < fontSettings.Length; nn++)
{
FontSetting fontSetting = fontSettings[nn];
if (fontSetting.StartIndex > i)
break;
if (i < fontSetting.StartIndex + fontSetting.Length)
{
if (fontSetting.Font.IsStrikeout)
{
return true;
}
}
}
return false;
}

Thanks,

Hi Salman,

i'm trying to test your example but there is a compile error:

I'm using VS2008 with framework. 3.5 and Aspose.Cells 5.1.1.0

The error is: Cannot Implicitily Convert Type System.Collection.ArrayList to Aspose.Cells.FontSetting[]

FontSetting[] fontSettings = xlSheet.Cells[r, c].GetCharacters();

Than, i would say that i have Aspose.cells license for the version 4.x.

Can i use the same license for the Aspose.Cells 5.x?

Best Regards

Hi,

Let me first look into this again. I will get back to you as soon as possible with the solution.

Thanks,

Hi,

Please try the attached version.

<span style=“font-size: 9pt; font-family: “Arial”,“sans-serif”;”>We have changed Cell.GetCharacters() method.


Please run the sample code (provided by us), it works fine now.
<span style=“font-size: 9pt; font-family: “Arial”,“sans-serif”;”><o:p></o:p>



Thank you.

Hi,

the problem seems to be solved, but my lincense is for 4.x version instead you give me 5.x patched.

What do you suggest? This is a big problem for me!

Hi,

Good to know your issue is resolved with new fix v5.1.1.2.

Well, If your license is expired, I am afraid, there is no way but to upgrade your subscription. Please do contact Aspose.Purchase team to upgrade your subscription.

Feel free to contact us any time if you have further queries or comments.

Thank you.

Hi,

my license is not expired, it's valid for 4.x version of Aspose.Cells but not for 5.x.

Can you tell me when the support of 4.x versions ends?

I'm not interested to 5.x version but i interested to correct the bug in the 4.x.

As i seen in the download section, last 4.x version released is dated 5/7/2010 1 month ago. is this already out of support? It's strange!

Where i can see the terms of support of the product?

Let me know

Hi,

I am not sure what do you mean by it is valid for 4.x version of Aspose.Cells but not for v5.x. If your license is not expired then you may use v5.1.1.2 and you should use it. If your license is expired then you cannot use the new fix. You may open your license file into notepad and check the expiry date. When you purchase the license of a product, you are eligible to use versions / bug fixes of the products that are released in the next whole year. But if a version/fix is released after your subscription expiry date, you need to upgrade your subscription.

Moreover, just for your knowledge, we cannot add or update functionality in the older or previous versions. So, I am afraid, you have to use our latest version/fix v5.1.1.2 only.

Thanks for your understanding!

The issues you have found earlier (filed as 19033) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.