I just upgraded Aspose.Cells.Gridweb dll and now the WebWorkSheet.Cells.SetStyle() method is failing. It worked fine in the previous version.
I am using Aspose.Cells.GridWeb version 2.7.7.2000
Previously I was using Aspose.Cells.GridWeb version 2.5.2.2000.
This is the code that was working and now fails:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack == true)
{
License license = new License();
license.SetLicense("Aspose.Cells.lic");
String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\Aspose\\Aspose.Cells for .NET\\Demos\\Common\\Database\\demos.mdb";
OleDbConnection conn = new OleDbConnection(connString);
//OleDbCommand cmd = new OleDbCommand("SELECT *, +1 FROM PRODUCTS", conn);
OleDbCommand cmd = new OleDbCommand("SELECT *, -1 FROM PRODUCTS", conn); //<-- this was crashing with previous dll
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
conn.Open();
da.Fill(ds, "PRODUCTS");
conn.Close();
WebWorksheet ws = gridWeb1.WebWorksheets[0];
ws.Cells.Clear();
ws.EnableCreateBindColumnHeader = true;
ws.DataSource = ds.Tables[0];
ws.CreateAutoGenratedColumns();
ws.DataBind();
Aspose.Cells.GridWeb.TableItemStyle style;
foreach (WebCell cell in ws.Cells)
{
style = cell.GetStyle();
style.ForeColor = Color.Red;
ws.Cells.SetStyle(cell.Row, cell.Column, 1, 1, style);
}
}
}
I tried attaching a zip of the project that works with old dlls and the project that now fails with new dlls. But the upload kept timing out.
Full error information:
System.InvalidOperationException was unhandled by user code
Message=Collection was modified; enumeration operation may not execute.
Source=mscorlib
StackTrace:
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at dynamicAsposeGridWeb.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Dev\_Sandbox\dynamicAsposeGridWeb-SetStyle-newdlls\WebForm1.aspx.cs:line 42
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: