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

Free Support Forum - aspose.com

AutoFitRows with CenterAcrossSelection


The AutoFitRows() function doesn't appear to take wrapped text than spans columns into account. Perhaps I am doing something wrong. With the following code, I am placing text into cell A1 and centering it across 4 columns. When I use the AutoFitRows() function, it sizes the row as if the text wasn't centered across the 4 columns. This isn't that big of a deal, but I was wondering if there may be an update that addresses this.

Thank you,

Dim oWorkbook As New Aspose.Cells.Workbook()

Dim oCells As Cells = oWorkbook.Worksheets(0).Cells

Dim oStyle As Style

Dim oRange As Range


oStyle = oWorkbook.Styles(0)

With oStyle

.Font.Color = Drawing.Color.Black

.Font.Name = "Arial"

.Font.Size = 8

.Font.IsBold = True

.Number = 0

.HorizontalAlignment = TextAlignmentType.CenterAcross

.VerticalAlignment = TextAlignmentType.Bottom

.IsTextWrapped = True

End With

oCells(0, 0).PutValue("This is an autofit rows test with wrapped data that spans multiple columns")

oRange = oCells.CreateRange(0, 0, 1, 4)

oRange.Style = oStyle


oWorkbook.Save("autofitrowstest.xls", SaveType.OpenInExcel, FileFormatType.Default, Me.Response)


We found the issue regarding AutoFitRows operation when we set the CenterAcross alignment for the cells.

We have logged your issue into our issue tracking system with an issue id: CELLSNET-14338 .

We will inform you when it is sorted out.

Thank you.


Please try the attached version. We have fixed your issue.

Thank you

This works perfectly. Thank you for addressing this so quickly.

The issues you have found earlier (filed as 14338) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.