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 :
Microsoft Dynamics AX (Archived)

Excel download by Ctl+T

(0) ShareShare
ReportReport
Posted on by 300

I want to change the color of fields on Excel when Excel download by Ctl +T.

I want to change the color of the title line of the first row.

For example)

Name field:Blue→Yellow

AccountNum field:Blue→Red etc...

4857.Capture.JPG

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    I would have a look at the 'performPushAndFormatting' method in class 'SysGridExportToExcel'. In there you will find the code that is opening excel and pasting the data in the sheet. I'd expect you should be able to do add some custom formatting or coloring in there.

    See also http://blogs.msdn.com/b/emeadaxsupport/archive/2009/09/07/how-does-the-export-to-excel-feature-work-under-the-hood.aspx for more details on how the export to excel function actually works.

    enjoy!

    Tom

  • Minoru Ohya Profile Picture
    300 on at

    Thank you. That sounds difficult.

  • Douglas Noel Profile Picture
    3,905 on at

    Hi Tim,

    this is not used in Ax2012 any more for exporting a Grid to Excel.

    Only valid for/until 2009. The class uses COM and require an installed excel application.

    You DONT need really an installed Excel for Grid Export to XL in 2012. Think this is handled internally by the kernel.

    The reason for this is, that, starting with 2012, you have to possibility (default is on) to export to a "local" Excel.Exe (better to the RDP client) on the machine the rdp client is running and you access and control Ax32 via RDP.

    Ax32 uses the open document classes to create native excel without the requirement to have excel installed. Even if on the RDP-controlling machine (RDP client) no Excel is installed, a native XL file will be created on the RDP client even.

    After creation of that file, the kernel tries to launch XL (local on the machine where the Ax32 process runs, or default on RDP, on the RDP client)

    The file creation process and the start of an 'maybe installed'  Excel.Exe is, we look at the RDP access of Ax32, on default done using a RDP VirtualChannel Extension which must be installed on the RDP client.

    But even if you 'Export to Server', which means the machine the Ax32 is running (the RDP server) you don't need to have an Excel.Exe installed.

    The 2012 Grid Export To Excel does definitely NOT use COM for that.

    So I think you won't have any chance to influence the behavior.

    regards

    Douglas

    .

  • Suggested answer
    Fredrik Sætre Profile Picture
    12,644 on at

    This is the default table layout suggested in Excel.

    Couldn't you after export just go to format and pick another theme for the table? Would that be sufficient?

    You can attack this by trying to change the default table format in Excel...

  • Fredrik Sætre Profile Picture
    12,644 on at

    Ah... Just realized you want special formating on each column. That isn't possible because it really doesn't do any formating. Then you would be better of developing your own class for this purpose.

  • Minoru Ohya Profile Picture
    300 on at

    Thank you very much for your confirmation.

  • JL Aguilera Profile Picture
    68 on at

    I have applied this solution in a version of AX 2009.

    You can change the TableStyleName in the method performPushAndFormatting of the class SysGridExportToExcel

    public static void performPushAndFormatting(container _moneyColumns, container _columnAlignments, container _formatColumns, int _numberOfRows)
    {
        #winapi
        #Excel
        #define.ListObjectName('MyGrid')
        //Begin - VAR - JLuis Aguilera - 07/05/2019 - Begin
        // Formato mas corporativo y legible que el amarillo.
        //#define.TableStyleName('TableStyleLight5')
        #define.TableStyleName('TableStyleMedium7') //New format.
        //End   - VAR - JLuis Aguilera - 07/05/2019 - End
        #define.NotifyMethod('notify')
        #define.xlListSeperator(5)
        #define.xlLocaleListSeperator(12)
    
  • Suggested answer
    Minoru Ohya Profile Picture
    300 on at

    Thank you

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans