Make Spreadsheet autosize a bit wider

1 Answer 78 Views
Spreadsheet
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 10 May 2023, 02:42 PM

I've found the AutoSize function for all the columns in a spreadsheet.

And it's NEARLY perfect: it's just too aggressive.

So after auto-sizing some columns, they look like this:

when the columns should look like:

It's only a small difference, but it's the difference between being able to see everything, and not.

Is there a way to make this function a bit more generous? Maybe add a little space ?

1 Answer, 1 is accepted

Sort by
0
Aleks
Telerik team
answered on 11 May 2023, 11:02 AM

Hi Ian,

Thank you for the precise information.

I managed to reproduce your case and it turned out that it is related to a wrong calculation inside the layout measurement logic. We have this logged on our feedback portal: SpreadProcessing: Column width is exported with a different value when the value is not an integer. I am afraid that there is no current workaround for this behavior.

Please make sure you are following the linked item so you can receive updates about any status changes on it.

We apologize for the inconvenience this may have caused.

If in need of any further support, please do not hesitate to reach back to us.

Regards,
Aleks
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 18 May 2023, 04:35 PM

Simple work around is to call the auto-size function, then add 10% :

myWorkbook.autoSizeAllColumns

...

  Dim width As ColumnWidth = ws.Columns(colNum).GetWidth.Value

   Dim newWidth = New ColumnWidth(width.Value * 1.1, width.IsCustom)

   ws.Columns(colNum).SetWidth(newWidth)

...

Aleks
Telerik team
commented on 19 May 2023, 06:36 PM

Hello Ian,

Thank you for your additional feedback.

I am happy to hear that you have found a workaround that does the job for your case.

Regards,
Aleks
Progress Telerik

Tags
Spreadsheet
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Aleks
Telerik team
Share this question
or