Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to work with Autofit function in BC 14?

(0) ShareShare
ReportReport
Posted on by

Hello people,

I am working in a report with the Excel Buffer.

Now I get my desired information in an Excel table after starting the report.

This also fits everything in terms of content. Only the columns are often much too narrow, so that I have to manually make all of them wider to be able to read the entire content.

I work here with BC 14. In NAV2016 there was a function Autofit. I suspect that this would automatically widen the columns. Only, unfortunately, this function no longer exists in BC 14.

Now I wanted to add this old function to table 370. For this I need the variable XlHelper.

In old NAV versions this variable had the subtype Microsoft.Dynamics.Nav.Integration.Office.Excel.ExcelHelper.'Microsoft.Dynamics.Nav.Integration.Office, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Now I wanted to create this variable in BC14. But I can't enter or search the subtype. It comes then always the error message that the type can not be loaded, if I load the Subtype from the old version. How do I do this? Is the subtype for BC 14 wrong?

Thank you.

  • Community Member Profile Picture
    on at
    RE: How to work with Autofit function in BC 14?

    Thank you so much for your support!!!

    I will now take over the function.

    Do you still have an idea how I get the NewColWith set individually per column?

    For example, the width for a column "Description" should be wider than for a column "Amount".

    As width it would be perfect, if I had always the maximum length of the value in a column.

    With Autofit something like this would have been possible...

  • Suggested answer
    YUN ZHU Profile Picture
    84,562 Super User 2025 Season 1 on at
    RE: How to work with Autofit function in BC 14?

    Hi, I tested this method and it works.

    pastedimage1651455322949v1.png

    The Sample Code below is from https://yzhums.com/4180/

    Before adding

    pastedimage1651455531253v2.png

    Add this method

    pastedimage1651456098767v4.png

    Test:

    pastedimage1651456081549v3.png

    Hope this helps

    Thanks.

    ZHU

  • Suggested answer
    Krati21 Profile Picture
    77 on at
    RE: How to work with Autofit function in BC 14?

    Hi,

    There is a function "SetColumnWidth" in Table Excel Buffer in BC14 which might help you. I have not tested this, but this can serve the purpose.

    pastedimage1651308516849v1.png

    Thanks!

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: How to work with Autofit function in BC 14?

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans