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.
You can try it to see if it can help:
Worksheet.get_Cells().get_Item(1, 3);
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 concanate your values in a variable (within x++ code) and assign than to an excel cell.
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);
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156