Skip to main content facebooktwittermenuarrow-up

.NET Core Excel Column Autofit - Community / GemBox.Spreadsheet Feature Request - GemBox Support Center

38

.NET Core Excel Column Autofit Completed

Please re-add the functionality for auto fit that was removed for the .NET Standard 2.0 version.

Official response

Mario at GemBox

Hi,

Please try using the latest GemBox.Spreadsheet for .NET Standard.
It has cross-platform support for AutoFit methods, it doesn't have Windows Forms dependency.

Regards,
Mario

Comments (7)

Alan Churchill
This is a very important add, IMO.
Stu Campbell
Yes, please support this. We can't use it without autofit.
Mario at GemBox
Hi,

We have recently released a GemBox.Spreadsheet for .NET Core 3.0 which does support AutoFit methods on Windows.
Currently, there is no cross-platform support.

To use it in desktop applications you'll need to use "Microsoft.NET.Sdk.WindowsDesktop" SDK and set the "UseWPF" property to "true".
To use it in a web application you'll need to add a framework reference for "Microsoft.WindowsDesktop.App".

Also, if your cells contain single font then perhaps you could create some approximation that would be based on text length and font size.
For instance, you could calculate the average widths of some characters, like numbers, lower case letters, and upper case letters, and use that to auto fit the content.
Additionally, you could perhaps handle separately the characters that have narrow font glyphs (for example those are typically letters 'i', 'I', 'j', etc.) and wide font glyphs ('O', 'W', etc.).

Hopefully, that would provide you decent accuracy for your requirement.

Regards,
Mario
Alan Churchill
Mario,

Thanks for tackling this issue knowing how hard it is. If GemBox was to support it for most of the common fonts (Arial, Tahoma, Courier, Calibri, etc.) it would satisfy most needs. Perhaps with an overload for adjustment (ex. AutoFit(decimal pctAdjust).

For now, I am fine with Windows only. WinForm and WPF support is also Windows Core only so that is a safe approach that covers most scenarios.

My opinion, of course.

Thanks for everything.
Mario at GemBox
Hi,

Support for AutoFit in .NET Core on Windows has been implemented and is available in the latest versions of GemBox.Spreadsheet for .NET 3.0.
Because most of these requests were for .NET Core on Windows, we'll mark this request as "Completed".

Regards,
Mario
Alan Churchill
Mario, any chance you can eliminate the Windows.Form dependence? I need this for a class library and that dependency seems unnecessary.
Alan Churchill
To be clear, I can understand why it was there but just asking if it is possible to remove it in the near term.