SheetRenderer Error with column widths less than 20px

Hi There;


It appears that the latest versions of Aspose.Cells have introduced an error in the SheetRenderer when the worksheet contains column widths less than 20 pixels. I’m pretty sure that this error wasn’t in v5.0, but it is definitely in the latest versions, which we just upgraded to to get the latest fixes.

The following code should illustrate the problem:

Dim loWorkbook As New Workbook()
Dim loSheet As Worksheet = loWorkbook.Worksheets(0)

For i As Integer = 0 To 3
For j As Integer = 0 To 3
loSheet.Cells(i, j).Value = System.IO.Path.GetTempFileName
Next
loSheet.Cells.SetColumnWidthPixel(i, 19)
'if you change this line to 20px wide and it works fine…
Next

Dim loRange As Range = loSheet.Cells.CreateRange(“A1:D4”)

Dim loOptions As New Aspose.Cells.Rendering.ImageOrPrintOptions
With loOptions
.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
.OnePagePerSheet = True
End With

Dim loRenderer As New Aspose.Cells.Rendering.SheetRender(loSheet, loOptions)
Try
Dim loImage As System.Drawing.Image = loRenderer.ToImage(0)
'Me.BackgroundImage = loImage
Catch ex As Exception
MsgBox(ex.ToString())
End Try

Regards,
Simon

Hi,

I have used your code and it works fine.

Please try the attached version and let us know if it works fine.

Thank you.

Hi There;


My apologies. I didn’t update the reference in my test project correctly, it is actually fixed in the latest version. Thanks for the quick response, apologies for the runaround.

Regards,
Simon