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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to use "Group" and COM objects using X++ in D365 FO ?

(0) ShareShare
ReportReport
Posted on by 5

HI All, 

I am retrieving a BOM Designer in Tree structure form, in to excel using X++ In D365, 

I want to Group the Cell using COM objects as we used in AX: 

Sample code of AX 4.0 

Code 1 : 

comRange = worksheetBOM.range(strfmt("%3%1:%4%2", rowLocal,row,'@SYS30306', '@SYS75441')).comObject();
comRange.select();
comSelection = comApplication.selection();
comRows = comSelection.rows();
comRows.group();

Code 2: 

comRange = worksheetBOM.range(strfmt("%3%1:%4%2", 1,1,'@SYS30306', '@SYS30306')).comObject();
comRange.select();
worksheetBOM.columns().autoFit();

How I can re-write above lines for D365 FO. 

Desired Output 

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    305,125 Super User 2026 Season 1 on at

    Hi Pravin,

    You can't use the COM objects anymore as we now have a cloud based solution which is not aware of any installed Office product. You can use OfficeOpenXML to create and work with Excel files. An example can be found here:  How to Create and Export Excel Files using X++ in D365 FO (d365snippets.com)

  • Pravin Profile Picture
    5 on at

    Hi Andre,

    Thank you for your reply,

    As I already Used same link to create the Export Excel using OfficeOpenXML Library.

    which gives me a expected output that I am looking for, But 

    I am looking for the solution for "Group", "Range" and "Selection" of the cell in Excel file using X++ which give me output of Tree node  in Excel file as screenshot attached Above.

    Regards,

    Pravin

  • André Arnaud de Calavon Profile Picture
    305,125 Super User 2026 Season 1 on at

    Hi Pravin,

    Thanks for the clarification. I would then suggest searching for the commands and examples on the internet. When you need to call specific Excel features, you can also consider using the Office forum.

    With a quick search, I was able to find a post related to grouping: [Solved] How to Group the Rows n a Excel using OpenXML SDK - CodeProject

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 771

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 629 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 496

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans