web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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.

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    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.

  • Suggested answer
    Krati21 Profile Picture
    77 on at

    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
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at

    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

  • Community Member Profile Picture
    on at

    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...

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans