SaveToExcelFile exception

Hello,

I'm using the Aspose WebGrid to read data from database and present it in a web browser.
The loading process is ok, but when I'm using the WebGrid.WebWorksheets.SaveToExcelFile I'm getting an exception:

"
. : Font size is out of range.
at ..? (Int32 )
at ?. .? (TableItemStyle , , DefaultParams , Hashtable , )
at ?. .? (Object , WebWorksheets , Boolean , ? )
at Aspose.Cells.GridWeb.Data.WebWorksheets.SaveToExcelFile(String targetFile)
"

I have also a similar case in which the same code is working well.
I’ve tried to use the following code to check what could be wrong, running against a sample that works and to another that throws the exception.

---
foreach (WebWorksheet ws in grid.WebWorksheets)
{
for(int r=0;r<ws.Cells.MaxRow;r++)
{
for (int c = 0; c < ws.Cells.MaxColumn; c++)
{
Aspose.Cells.GridWeb.TableItemStyle s= ws.Cells[r, c].GetStyle();
System.Diagnostics.Debug.Print("{3} Row {0:00} Col {1:00} FS {2} H {4} W {5}", r, c, s.Font.Size, ws.Index, ws.Cells.GetRowHeight(r), ws.Cells.GetColumnWidth(c));
}
}
}
--

Unfortunately, it gave the same result to both cases.
Can you please help me understand what could be wrong?

Many thanks,
António Carvalho

Hi,


Could you please provide us a simple project to reproduce the issue on our end, we will check it soon.
Also, kindly use our latest version/fix: Aspose.Cells for GridWeb v8.2.1.2.

Thank you.

Hello,


I’m sorry, but I can’t provide a sample.
As I’ve described, the same code is working for other customer data; it’s a special case. I think it could be some property that has a strange value.

I was hoping you could help me identify that property. Since you can look at the code, you could check what can make the grid throw the exception.

Do you have a suggestion for me to check some property in the grid, the cells, etc?

Also, I cannot at this point move to a new version; the last time I’ve done it, the application became too slow, and I had to revert to version 2012.04.12.

Hi,


It looks strange to us that similar code is working fine for other client.

I am afraid, we cannot fix any issue (if found) in older versions. The fixes are only based on latest APIs set of the component, so we would recommend you to kindly try our latest version of the product in which we included several enhancements and other fixes. And, if we found any issue, we can provide you the fix based on latest versions. Moreover, since you are using some older version of the product and we are not sure why you are getting Font size error while saving the excel file. I think at least you could try using latest version in a separate project to test your sample code (with your template file if you have any) if it works (in evaluation mode - without using/ setting license etc.) or you are still getting similar error.


Thank you.

Hello,


I’m sorry if I miss led you to think I need to fix your control.
I am, for now, asking if you can help me to understand why it works in one case and throws the exception in the other.

What I need from you is a clue where to check, what properties must I confirm, since you have the knowledge to point me what could be making the control throw the exception.
I’ve produced with the code that I’ve posted, a list with the font sizes, but in both cases the list has the same values for all cells in all worksheets.

I hope my English is clear enough for you to understand what I’m looking for.

Any way, I’ll do the test with the new version, both for performance and for the export.

Regards,
António Carvalho

Hi,


Well, I am not sure and have no clue why it works for one machine but not for other machine. Aspose.Cells.GridWeb is created in pure .NET APIs, which only needs .NET framework to be installed on the server (the control should be registered on it) to work with it irrespective of OS and other things. Logically if it works on one machine, it should equally work fine on other machines. By the way, could you compare both machines’ configurations (a machine where it works fine and other machine it does not work), you may also try to check and compare other certain things, e.g OS, browser types, etc.

Also, we will wait for your test with the latest version of Aspose.Cells.GridWeb i.e. v8.2.1.

Thank you.

Hi,


Please let me make a correction.
It both works and throws the exception in the same machine.
The problem is not the machine, or the installation, or even the configuration , the IIS - it’s the data in the grid!

One pack of data makes the grid throw the exception, and another works well.
That’s why I think this is not necessarily a problem in the control.

Regards,
António Carvalho

Hi,


Thanks for your clarification. We appreciate if you could create a simple sample project, you may zip it to post it here, we will check it soon. Also kindly provide details about the steps involved and data you are using which produces the error on our end. We will figure your issue out in our latest versions (if found).

Thanks for your cooperation.

Thank you.

Hello,


I’ve manager to figure out the problem after so many try/error/analyze sequences…
I was setting a font size to 0 (Font.Size = FontUnit.Point(0)). I’ve removed this code and it’s working well.

About the new version, I did try to make it work. It has so many changes, It’s a never ending thing…
And finally, when I thought it was ready, it started trowing an exception right at the begin:

NullReferenceException: Object reference not set to an instance of an object.]
..’(MainWeb ) +91
Aspose.Cells.GridWeb.MainWeb.”() +99
Aspose.Cells.GridWeb.MainWeb.() +108
Aspose.Cells.GridWeb.MainWeb.OnPreRender(EventArgs er) +243
System.Web.UI.Control.PreRenderRecursiveInternal() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
"

Any ideia?

Regards,
António Carvalho

Hi,


Good to know that you have traced the original issue and figured it out.

almc:

....About the new version, I did try to make it work. It has so many changes, It's a never ending thing...
And finally, when I thought it was ready, it started trowing an exception right at the begin:

NullReferenceException: Object reference not set to an instance of an object.]
   ..’(MainWeb ) +91
   Aspose.Cells.GridWeb.MainWeb.”() +99
   Aspose.Cells.GridWeb.MainWeb.() +108
   Aspose.Cells.GridWeb.MainWeb.OnPreRender(EventArgs er) +243
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
"

I am afraid, the error "NullReferenceException: Object reference not set to an instance of an object." has many applications, so we can't detect based on mere exception. We appreciate if you could create a simple project (runnable) with our latest version/fix Aspose.Cells.GridWeb v8.2.2, zip it and post it here, we will check it soon. Also please make sure to use latest acw_client resource files in your project (you may set the configurations/ path in the web.config file in your web project).


Thanks and again sorry for any inconvenience caused to you.