7.2 version set_CultureInfo problem on the test server

Hello,


I’ve recently migrated from the 4.7 version to the 7.2 on 2 web applications. During developpement, it worked out fine for both, but now one of the webapps made it to the test server and it has a problem that seems kind of obscure.

Here’s the trace :

Url : /EasyAFV/admin_matrice.aspx
Identité : ADICU

Erreur : System.Web.HttpUnhandledException: Exception of type
System.Web.HttpUnhandledException was thrown. —>
System.IndexOutOfRangeException: Index was outside the bounds of the array. at
—.Š‹…ctor(CultureInfo ) at —.™.ˆe() at
—.™.set_CultureInfo(CultureInfo ) at —.™…ctor(Workbook ) at
Aspose.Cells.WorkbookSettings…ctor(Workbook ) at Aspose.Cells.Workbook…ctor()
at afvnet.admin_matrice.imgBtnExpExcel_Click(Object sender, ImageClickEventArgs
e) at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain() — End of inner exception stack trace
— at System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context) at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)

The application can run in French or English. I only get this error only in French. The trace doesn’t give too much information and it seems to happen inside of the Aspose code.

Here’s some ASP VB.NET 1.1 sample code :

#Region “Export matrices”

Private Sub imgBtnExpExcel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgBtnExpExcel.Click

If ddlDivision.SelectedValue <> String.Empty Then

Dim trans As OracleTransaction
Dim donnees As DataTable
Dim conn As New OracleConnection(ConfigurationSettings.AppSettings.Get(“ConnectionStringODP”))

Try

conn.Open()
trans = conn.BeginTransaction()

donnees = WrkfDB.SelectionMatricePourExportExcel(ddlDivision.SelectedValue)

trans.Commit()

Catch ex As Exception
If Not trans Is Nothing Then
trans.Rollback()
End If

Throw ex
Finally
conn.Close()
End Try

Dim resp As HttpResponse = HttpContext.Current.Response
resp.Clear()

Dim AsposeLicence As New Aspose.Cells.License
Dim license As String = “…/resources/licences/Aspose.Cells.lic”
AsposeLicence.SetLicense(license)

Dim excelBook As New Workbook
Dim excelSheet As Worksheet = excelBook.Worksheets(0)

InitStyleEntete(excelBook)
InitStyleDonnee(excelBook)
EcrireEntetes(excelSheet)
EcrireDonnees(excelSheet, donnees)

excelSheet.AutoFitColumns()
excelSheet.AutoFitRows()

Dim filename As String = String.Format(rm.GetString(“admin_fichier_export_matrice”), ddlDivision.SelectedValue, Utils.yyyyMMddhhmmss)

'excelBook.Save(filename + “.xlsx”, FileFormatType.Xlsx, SaveType.OpenInExcel, resp)
'FFT5484
excelBook.Save(resp, filename + “.xlsx”, Aspose.Cells.ContentDisposition.Attachment, New XlsSaveOptions(Aspose.Cells.SaveFormat.Xlsx))

resp.End()

End If

End Sub

Private Sub InitStyleDonnee(ByVal excelBook As Workbook)
Me._styleDonnee = excelBook.Styles(excelBook.Styles.Add())
Me._styleDonnee.Pattern = BackgroundType.Solid
Me._styleDonnee.Font.Size = 8
Me._styleDonnee.Font.IsBold = True
Me._styleDonnee.Borders(BorderType.TopBorder).LineStyle = CellBorderType.Thin
Me._styleDonnee.Borders(BorderType.BottomBorder).LineStyle = CellBorderType.Thin
Me._styleDonnee.Borders(BorderType.RightBorder).LineStyle = CellBorderType.Thin
Me._styleDonnee.Borders(BorderType.LeftBorder).LineStyle = CellBorderType.Thin
Me._styleDonnee.IsTextWrapped = True
Me._styleDonnee.ShrinkToFit = False
End Sub

Private Sub EcrireDonnees(ByRef excelSheet As Worksheet, ByVal donnees As DataTable)

If donnees.Rows.Count > 0 Then

Dim col As Integer = 1
Dim row As Integer = 0
Dim str As String = String.Empty
Dim excelCell As Cell = Nothing
Dim i As Integer = 0
Dim j As Integer = 0

For j = 0 To donnees.Rows.Count - 1
Dim dataRow As DataRow = donnees.Rows(j)
For i = 0 To NB_LIGNES_MATRICE - 1
excelCell = excelSheet.Cells(row, col)
'FFT5484
excelCell.SetStyle(Me._styleDonnee)
'remplacement des 0//1 par des oui/yes//non/no
If i = 1 Then
str = OutilDB.DBNull(dataRow(“Used”))
str = IIf(str = “1”, rm.GetString("_rdok"), rm.GetString("_rdno"))
ElseIf i = 13 Then
str = OutilDB.DBNull(dataRow(“AutoDesignation”))
str = IIf(str = “1”, rm.GetString("_rdok"), rm.GetString("_rdno"))
Else
str = OutilDB.DBNull(dataRow(i))
End If
excelSheet.Cells(row, col).PutValue(str)
row = row + 1
Next
col = col + 1
row = 0
Next
End If

End Sub


Private Sub InitStyleEntete(ByVal excelBook As Workbook)
Me._styleEntete = excelBook.Styles(excelBook.Styles.Add())

Me._styleEntete.ForegroundColor = ColorTranslator.FromHtml("#CCCCCC")
Me._styleEntete.Pattern = BackgroundType.Solid
Me._styleEntete.Font.Size = 8
Me._styleEntete.Font.IsBold = True
Me._styleEntete.Borders(BorderType.TopBorder).LineStyle = CellBorderType.Thin
Me._styleEntete.Borders(BorderType.BottomBorder).LineStyle = CellBorderType.Thin
Me._styleEntete.Borders(BorderType.RightBorder).LineStyle = CellBorderType.Thin
Me._styleEntete.Borders(BorderType.LeftBorder).LineStyle = CellBorderType.Thin
Me._styleEntete.IsTextWrapped = True
Me._styleEntete.ShrinkToFit = False
End Sub

Private Sub EcrireEntetes(ByRef excelSheet As Worksheet)

'Entête = titres des colonnes
Dim excelCell As Cell = Nothing
Dim col As Integer = 0 'indice des colonnes effectivement exportées
Dim row As Integer = 0

Dim i As Integer = 0
For i = 0 To NB_LIGNES_MATRICE - 1
excelCell = excelSheet.Cells(row, col)
excelCell.PutValue(String.Empty)
'FFT5484
excelCell.SetStyle(Me._styleEntete)
row = row + 1
Next

row = 0
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblSite”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblUsed”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblActivity”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblCategory”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblProductType”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lbl1stCriteria”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lbl2ndCriteria”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lbl3rdCriteria”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh1Marketing”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblCompTreatement”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblCompTService”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblProcessOwner”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblProProService”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblAutoDesignation”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPilot”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2Purchase”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2Management”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2IndusMethods”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2CentralLog”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2SiteLog”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2SIS”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh2PPPS”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh3GRAGDT”))
row = row + 1
excelSheet.Cells(row, col).PutValue(rm.GetString(“afv_export_matrice_lblPh3Management”))
End Sub

#End Region

While migrating from 4.7 to 7.2 several changes were made to the code, mainly concerning:
- cell styles and the way they were applied
- save file method

I’m kind of lost with this error. Any input will be much appreciated.

Thanks,
Alin

Hi Alin,


Could you give it a try using the latest version/fix: Aspose.Cells for .NET v7.2.2.1

Let us know your feedback.

Directly switching the given dll on the test server gives this error :


Url : /EasyAFV/admin_matrice.aspx?c=en-US
Identity
: ADICU
Error : System.Web.HttpUnhandledException: Exception of
type System.Web.HttpUnhandledException was thrown. —>
System.BadImageFormatException: The format of the file ‘Aspose.Cells’ is
invalid. File name: “Aspose.Cells” at
afvnet.admin_matrice.imgBtnExpExcel_Click(Object sender, ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain() === Pre-bind state information === LOG:
DisplayName = Aspose.Cells, Version=7.2.0.0, Culture=neutral,
PublicKeyToken=716fcc553a201e56 (Fully-specified) LOG: Appbase =
file:///D:/EASYC/EasyAFV LOG: Initial PrivatePath = bin Calling assembly :
afvnet, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null. === LOG:
Publisher policy file is not found. LOG: No redirect found in host configuration
file (C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet.config). LOG: Using
machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config. LOG:
Post-policy reference: Aspose.Cells, Version=7.2.0.0, Culture=neutral,
PublicKeyToken=716fcc553a201e56 LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/easyafv/8ad0ae65/d6f9d9a1/Aspose.Cells.DLL. LOG: Attempting download of
new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/easyafv/8ad0ae65/d6f9d9a1/Aspose.Cells/Aspose.Cells.DLL. LOG: Attempting
download of new URL file:///D:/EASYC/EasyAFV/bin/Aspose.Cells.DLL. — End of
inner exception stack trace — at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain() at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)

I’ve tried to switch the dll in VS2003, but it did no longer compile. I’ll try to downlod the complete package and pick and switch the dlls on MOnday.

Hi,


If you are using VS.NET 2003 with .NET Framework 1.x, you need to use .NET 1.x compiled version of Aspose.Cells for .NET v7.2.2. Please download the package and install from the release:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry389762.aspx


Note: The fix (v7.2.2.1) I provided in my previous reply is .NET 2.0 compiled version that may not work on VS.NET 2003.

Please try the .NET 1.x compiled version from "net1.x" folder at your installation directory and let us know your feedback.

Thank you.

Hello again,

I download and used the version 7.2.2.0 in developpement and on the test server.

I still get the same behaviour and the same message on the test server :

Url : /EasyAFV/admin_matrice.aspx
Identité : ADICU
Erreur : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at —.Š‹..ctor(CultureInfo ) at —.™.ˆe() at —.™.set_CultureInfo(CultureInfo ) at —.™..ctor(CountryCode ) at Aspose.Cells.WorkbookSettings..ctor(Workbook , CountryCode ) at Aspose.Cells.Workbook..ctor() at afvnet.admin_matrice.imgBtnExpExcel_Click(Object sender, ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain() --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I'll continue looking into this problem.

Let me know if you have any more information.

Thanks,
Alin

Hi,

Please give us the default culture info used by your application(CultureInfo.CurrentCulture) so we can figure the issue out.

The default culture is "fr-FR": it works fine on the developpement platform, but it bugs in the test one.

The other culture is "en-US": it works fine on the developpement platform and on the test server.

We deploy in IIS under Windows Server 2003 from a MSI generated with VS2003 in the same solution.

Let me know if you desire any other information.

Hi,


Thanks for providing complete details about your culture and environment.

We will look into your issue. Once we have any update about it, we will let you know here.

Thank you.

I gradually simplified the code and it now resumes to creating an empty workbook and saving into XLSX format under the "toto" name.

It looks likes this :

Private Sub imgBtnExpExcel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgBtnExpExcel.Click

If ddlDivision.SelectedValue <> String.Empty Then

'Dim trans As OracleTransaction

'Dim donnees As DataTable

'Dim conn As New OracleConnection(ConfigurationSettings.AppSettings.Get("ConnectionStringODP"))

'Try

' conn.Open()

' trans = conn.BeginTransaction()

' donnees = WrkfDB.SelectionMatricePourExportExcel(ddlDivision.SelectedValue)

' trans.Commit()

'Catch ex As Exception

' If Not trans Is Nothing Then

' trans.Rollback()

' End If

' Throw ex

'Finally

' conn.Close()

'End Try

Dim resp As HttpResponse = HttpContext.Current.Response

resp.Clear()

Dim AsposeLicence As New Aspose.Cells.License

Dim license As String = "../resources/licences/Aspose.Cells.lic"

AsposeLicence.SetLicense(license)

Dim excelBook As New Workbook

'Dim excelSheet As Worksheet = excelBook.Worksheets(0)

'InitStyleEntete(excelBook)

'InitStyleDonnee(excelBook)

'EcrireEntetes(excelSheet)

'EcrireDonnees(excelSheet, donnees)

'excelSheet.AutoFitColumns()

'excelSheet.AutoFitRows()

'Dim filename As String = String.Format(rm.GetString("admin_fichier_export_matrice"), ddlDivision.SelectedValue, Utils.yyyyMMddhhmmss)

Dim filename As String = "toto"

'excelBook.Save(filename + ".xlsx", FileFormatType.Xlsx, SaveType.OpenInExcel, resp)

'FFT5484

excelBook.Save(resp, filename + ".xlsx", Aspose.Cells.ContentDisposition.Attachment, New XlsSaveOptions(Aspose.Cells.SaveFormat.Xlsx))

resp.End()

End If

End Sub

I don't think it can get simpler than that and it still bugs on the test server.

So :
- the test environnement has a weakness that is detected only now with the new version of Aspose
- Aspose has a little problem.

Since I only have it on the test server, I can't really debug it much further.

Hi,

Thanks for drilling down the issue.

I have logged it in our database. Hopefully, it will be helpful for the development team to investigate this issue.

Once, there is some update for you, we will let you know asap.

This issue has been logged as CELLSNET-40783.

Hi,

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

We have made some enhancements for handling invalid information got from
cultureinfo. Please try this fix to see whether it can solve your issue.

Hello,


Thank you for your efforts.

Unfortunately, I think there’s the same problem with this provided DLL. My 1.1 .Net solution will not compile with this DLL.

And there’s no public release for this 7.2.2.2 fix, in order for me to pick the appropriate version of the DLL.

Would it be possible to have the DLL compiled for the requirements of my solution?

Alin

Hi,

Thanks for your feedback.

I have requested the development team to provide the DLL that could work with .NET framework 1.1

We will provide you the required dll soon.

Hi,

Please download the .NET framework 1.1 DLL: Aspose.Cells for .NET v7.2.2.2 (.NET 1.1)

Good morning,


I’ve tested the fix and it looks like the problem is solved.

I’ve reverted to the original code and the Excel export seems to work in both French and English on the test server.

It’s early morning, so I’ll continue testing it through the day.

You saved the day, it’s reassuring to have a support that we can count on.

Would it be inappropriate to know what was changed?

Bye,
Alin
Hi,

We had assumed that formatting informations got from CultureInfo object should not be empty, such as the number separator, datetime patterns, and so on. But from your reported issue we found that some of those informations may be empty for your special enviornment, so we add additional check for those informations to avoid the exception.

Yeah, the servers of my client are home made and maintained, so they could be a bit special :smiley:


Thank you and good luck!

Hi,

Thanks for the information.

If you have any other questions, please feel free to post, we will be glad to help you.

Thanks for your time.