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

Free Support Forum - aspose.com

ExecutionEngineException while using Aspose styles

Hi, below code snippet is throwing ExecutionEngineException in one of the scenario. We have not analyzed the issue completely and we'll be doing that shortly. We are not sure which piece of Aspose API threw the exception.

Linr from crash dump points to

000000001f91d860 000006447839f2e5 System.String.CtorCharCount(Char, Int32)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Can you look at below code and see which statement can result into above exception? Also please let us know if others encountered similar issue.

Style style = new Style();
style = cell.GetStyle();
style.Font.Color = Color.Black;

#region Handles special character such as tab, new line and carriage return
char cr = (char)13;
char lf = (char)10;
char tab = (char)9;
if (cell.Value.ToString().Contains(cr.ToString()) || cell.Value.ToString().Contains(lf.ToString()) || cell.Value.ToString().Contains(tab.ToString()))
{
if (cell.Value.ToString().Contains(tab.ToString()))
cell.Value = cell.Value.ToString().Replace("\t", " ");
style.IsTextWrapped = true;
}
#endregion
#region Maps cell data type information and applies cell level style accordingly
switch (type.FullName.ToString())
{
case "System.Decimal":
case "System.Double":
case "System.Int32":
case "System.Int64":
case "System.DateTime":
case "System.Runtime.InteropServices.CurrencyWrapper":
case "System.Boolean":
style.HorizontalAlignment = TextAlignmentType.Right;
break;
default:
break;
}
#endregion
cell.SetStyle(style);

This is the trace from crash dump retrieved from a server

000000001f91d5f8 0000000077ef09ea [HelperMethodFrame: 000000001f91d5f8]

000000001f91d860 000006447839f2e5 System.String.CtorCharCount(Char, Int32)

000000001f91d8b0 000006448191c35a ServerSideExcelExport.AsposeExcelDataProvider.ApplyStyleToCell(Aspose.Cells.Cell, System.Type)

000000001f91d960 000006448190791c ServerSideExcelExport.AsposeExcelDataProvider.PopulateAsposeExcelFromDataSetWithFormatting(System.Data.DataSet)

000000001f91da80 0000064481c0e057 CCH.Pfx.Tax.ViewsService.ServiceImplementation.TaxViewsServiceImplementation.GetViewDataForExport(CCH.Pfx.Tax.Entities.ViewParameterData)

Please let us know if there is possbile solution.

Thanks

Prasad

Hi,

Please download and use the latest version:
Aspose.Cells
for .NET v7.1.2.5

and let us know your feedback.

If the problem still occurs, then we will need your runnable sample code replicating the problem to look into this issue.