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

Free Support Forum - aspose.com

Parameter is not valid AutoFitRows()

Hello,

I am receiving this error in our production environment and I need help to fix it ASAP.

<span style=“font-size: 12pt; font-family: “Times New Roman”,“serif”;”>System.Web.HttpUnhandledException: Exception of
type ‘System.Web.HttpUnhandledException’ was thrown. —>
System.ArgumentException: Parameter is not valid. at
System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format) at
System.Drawing.Bitmap…ctor(Int32 width, Int32 height) at x9d2539cac3622db3.xf0a3dde88cf2ccd4.xf1ff2f45648764da()
at x9d2539cac3622db3.xf0a3dde88cf2ccd4.x055656f5d767c02d(Cells
x77bb6a53fbd162d0, Int32 x6155c61fc47ceb1a, Int32 x433508a87b1e0cdf, Int32
xa364300db00bde74, Int32 x8e5bc30d03570f25, AutoFitterOptions xdfde339da46db651)
at Aspose.Cells.Worksheet.AutoFitRows() at
eA.Analytics.Presentation.eAReporter.ReporterResultsDetail.ExcelExport()

We are not embedding any bitmaps to the excel report, so I do not know why I see the System.Drawing.Bitmap namespace in the error report.

Thanks


Hi,

Please post your template excel file with sample code to reproduce the issue you have mentioned.

We will check it soon.

Thank you.

Hello,

We are not using a template to create the excel file. All we are doing is looping a datatable and inserting values into the sheet. Here is our code below:

Private Sub ExcelExport()
'm_strUserID = Context.Request(“Uid”).ToString
Dim WB As New Workbook
Dim i As Integer = 0
Dim iRowFreeze As Integer = 0
Dim iHiddenCols As Integer = 0
Dim iColCount As Integer

If eA.Analytics.Presentation.Common.AsposeManager.SetAsposeLicense() = False Then Return
For Each dt As DataTable In ReporterDataset.Tables
WB.Worksheets.Add(SheetType.Worksheet)
Dim Sheet As Worksheet = WB.Worksheets.Item(i)
Sheet.Name = dt.TableName

Select Case dt.TableName
Case “General Info”
Me.Export(Sheet, dt)
If dt.Columns.Contains(“ProductId”) Then
'Note: Hidden columns will be: Seq, ProductId, FirmId
If EAUser.isAdmin Then iRowFreeze = 4 Else iRowFreeze = 2
If EAUser.isAdmin Then iHiddenCols = 1 Else iHiddenCols = 3
Else
'Note: Hidden columns will be: Seq, FirmId
If EAUser.isAdmin Then iRowFreeze = 3 Else iRowFreeze = 1
If EAUser.isAdmin Then iHiddenCols = 1 Else iHiddenCols = 2
End If
Case “Quarterly Return Series”, “Monthly Return Series”
Me.Export(Sheet, dt)
iRowFreeze = 1
Case “Key Professionals”
Me.Export(Sheet, dt)
If EAUser.isAdmin Then iRowFreeze = 3 Else iRowFreeze = 1
If EAUser.isAdmin Then iHiddenCols = 1 Else iHiddenCols = 2
End Select

iColCount = dt.Columns.Count - iHiddenCols
'If chkExcel2003.Checked AndAlso iColCount > 256 Then iColCount = 256
If iColCount > 256 Then iColCount = 256

Dim headerCell As Cell = Sheet.Cells(0, 0)
headerCell.PutValue("Results in currency: " & m_strResultsCurrency)
Dim HeaderRange As Range = Sheet.Cells.CreateRange(1, 0, 1, iColCount)

'If chkExcel2003.Checked Then
'note: Had to use old style due to eA Blue color not workin with Aspose 2003 export option
eA.Analytics.Presentation.Common.AsposeStyler.eABlueBoldWithWhiteBackground(WB, HeaderRange)
'Else
'eA.Analytics.Presentation.Common.AsposeStyler.eABlueBoldWithWhiteBackground(WB, HeaderRange)
'End If

Sheet.FreezePanes(2, iRowFreeze, 2, iColCount)
Sheet.AutoFitRows()
i += 1
Next

'Saves file to memory
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream()
WB.Save(stream, FileFormatType.Excel2003)
Response.ContentType = “application/vnd.ms-excel”
'This is same as OpenInExcel option
Response.AddHeader(“content-disposition”, “attachment; filename=book1.xls”)
Response.BinaryWrite(stream.ToArray())
stream.Dispose()
stream = Nothing
WB = Nothing

End Sub

Hi,

Please try the attached latest version/fix v4.9.1.6.

If you still find the issue, we appreciate if you could create a sample console application in VS.NET (you may use/create some dummy data tables (if appropriate) to fill the worksheet cells with them), zip it and post it here to reproduce the issue. It will help us to know about your data sets and help us in figuring out your issue very soon.

Thank you.

Thank you for your help. I will try this fix this coming week and will let you know if I have more troubles.