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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to pad the fields with spaces being exported to excel

(0) ShareShare
ReportReport
Posted on by

Hi all,

I have a requirement to export data to excel. This is all fine.

But the problem is it should of fixed lenght excel lines and if the respective data from Ax is less than the intended length it should be padded with spaces to reach the length.

Can anyone help on this.

I am able to create a field with all spaces and export to excel. But coudld'nt get this padding of spaces work.

Thanks

*This post is locked for comments

  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    What do you use for create the XLS file?

    COM Classes?

  • Community Member Profile Picture
    on at

    What is the purpose of this requirement

    are you looking to manage the width of excel cell this padding of spaces?

    if yes then its not possible this way...

    for this purpose while exporting values to excel cell, you need to set the width of the excel cell

    Please verify and update us with more details.

  • Community Member Profile Picture
    on at

    Hi All,

    Thanks for your responses.

    I am exporting the data from AX to import into another system for data integration.

    To import this into the other application the excel need to satisfy the below criteria -

    "Each line in the interface file has a fixed length of 307 characters. Any fields not populated or not using all allocated characters must be padded with spaces (if defined as character fields) or zeroes (if defined as numeric).   "

    So each column is already allocated fixed space. If the data from Ax falls short of this I need to get this padded with spaces.

    I am using SysExcelApplication to create the output excel file.

    Thanks

  • Suggested answer
    Community Member Profile Picture
    on at

    In this scenario, it can not be a excel import.

    you need to create a fixed width text file

    so you sould consider AsciiIO class for this purpose

    and for each column you need to check and see it the field is having space and Zeros padded

    Please find more details about AsciiIo class in following link

    msdn.microsoft.com/.../asciiio.aspx

    please verify and let us know with your findings

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans