My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

15 June 2010

Export to Excel with X++ code: continued

by Patrik Luca 2 comments

Tag



Introduction

I wrote already in the past about the possibilities to export data from your Dynamics AX ERP system to Microsoft Excel through X++ code.

My first post Export to Excel with X++ code described how to export some data to different worksheets in an Excel file.

My second post Export to Excel with X++ code: the sequel described how to format the exported data in the Excel export file.

In this post I further elaborate about the formatting of data.

Use of the comObject method of the SysExcelStyle class

I already explained the use of the SysExcelStyle class in my previous posts. I created a Header style and set its font to bold and a specific color. These methods are easy to use, as they can found with the IntelliSense functionality.

However, by using the comObject method, you can go even further and have extra formatting possibilities at your disposal. Unfortunately, these can’t be found with IntelliSense, nor I find documentation about it. I found already these possibilities, if someone finds other ones, please post a comment: it could be handy for others aswell…


...
SysExcelStyle style;
;

...
// Set orientation
style.comObject().orientation(90);
// distribute text
style.horizontalalignment(-4117);
// center text
style.horizontalalignment(-4108);
// right align text
style.horizontalalignment(-4152);
// set indent level
style.comObject().indentlevel(5);
// wrap text
style.comObject().wraptext(true);
...

Comments 2 comments
Anonymous said...

Thank you Patrik Luca i has helped me lot.
now i am want to export the data from excel sheet in designed format means like i want to display data like UML class format so can you please help me

Thank You,

Anonymous said...

This was helpful too https://axapta2009.wordpress.com/2014/05/30/applying-formats-to-excel-reports-using-x-in-ax-2009/

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Live Traffic Feed

Recent Visitors

Blog Archive

My Blog List

Followers

Guest Links