Skip to main content

Notifications

Microsoft Dynamics AX forum

Creating Excel workbook via X++

Posted on by

I have the task of creating a Excel workbook for our international freight forwarders.  The workbook includes items such as the sales order #, item Id, sales Qty, etc, etc.  The workbook is generated and send to the freight forwarders to full in with the flight information use to delivery the order to our customers.  They send the workbook back to us for we can generate a pretty report to send to the customer.  The issue is the freight forwarders are constantly misspelling or abbreviating the name of the airlines.  I would like to include a data validation / named list in the airline name cells from X++.  Is this doable?  Here's a link showing what I want to perform programmatically with X++:

http://office.microsoft.com/en-us/excel-help/create-or-remove-a-drop-down-list-HP005202215.aspx

*This post is locked for comments

  • Suggested answer
    Kenny Saelen Profile Picture
    Kenny Saelen on at
    RE: Creating Excel workbook via X++

    There are some options.

    Since you cannot use the template (which would be the best option actually as Will L proposed), there are other options:

    1: Use the X++ framework to write XLS files. msdaxerp.wordpress.com/.../writeread-to-excel-sheet

    2: You can also just write an XML so that you can have fast and easy X++ code. Then you can apply an XSLT to fit the format op XLSX (which is a zip with XML in it). I once wrote a post on that. www.ksaelen.be/.../using-c-xml-xslt-to-create-excel-spreadsheet

    3: look for a good .net API and call that one from AX. visualstudiogallery.msdn.microsoft.com/81c33294-eee9-4683-9cee-a5714cfebf34 But this might be a bit overkill too.

  • RE: Creating Excel workbook via X++

    Will,

    Thanks for your reply, but I don't think a template will work.  The list of airlines is too dynamic for a template and the number of orders various from single digits to several hundred.  So I think creating the data validation list via X++ is the best solution.  So any help?

    JIm R.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creating Excel workbook via X++

    The easiest way would be to create an Excel template with the data validation rules already applied.  When your X++ runs you can write the cells for the Source of your data validation or if you already know them ahead of time leave them prepopulated.  So you are writing to a partially formatted excel template instead of trying to do every thing with X++ code.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,867 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,173 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans