Hi,
We have a requirement to generate an Excel report in d365, in report we have to merge multiple cells into one, Quick responses are appreciated.
Thanks in Advance.
Hi Sowmya170106,
Please try the code segment to merge cells through X :
SysExcelRange sysExcelRange; sysExcelRange = workSheet.cells().range('E18:F18'); sysExcelRange.comObject().MergeCells(1); SysExcelRange.horizontalAlignment(#xlCenter);
You can concanate your values in a variable (within x++ code) and assign than to an excel cell.
Hi Judy,
Thanks for the Response,
I have tried with below code but getting errors as i.e., (the name SysExcelRange does not denote a class or a table or an ExtendedDataType),
(Method 'cells()' is not found on type 'OfficeOpenXml.ExcelWorksheet').
#define.xlCenter(-4108) DocuFileSaveResult saveResult = DocuFileSave::promptForSaveLocation("@ApplicationPlatform:OfficeDefaultWorkbookFileName","xlsx", null, "excel create and export"); if (saveResult&& saveResult.parmAction() != DocuFileSaveAction::Cancel) { saveResult.parmOpenParameters('web=1'); saveResult.parmOpenInNewWindow(false); System.IO.Stream workbookStream = new System.IO.MemoryStream(); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); using(var package = new OfficeOpenXml.ExcelPackage(memoryStream)) { var worksheets = package.get_Workbook().get_Worksheets(); var worksheet = worksheets.Add("Sheet1"); var cells = worksheet.get_Cells(); SysExcelRange sysExcelRange; sysExcelRange = workSheet.cells().range('E18:F18'); sysExcelRange.comObject().MergeCells(1); SysExcelRange.horizontalAlignment(#xlCenter); package.Save(); }
You can try it to see if it can help:
Worksheet.get_Cells().get_Item(1, 3);
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 683 Super User 2025 Season 2
CA Neeraj Kumar 620
Martin Dráb 563 Most Valuable Professional