To avoid eventual issues while working with Excel objects in X++, do not forget about COMVariant type in AX!
Lets say we output some information directly to an Excel file and want to change the current row height based on the number of strings on notes.
Unfortunately, I had spent so much time trying to understand the reason of errors until I found this posting. Thank you Max!
Lets say we output some information directly to an Excel file and want to change the current row height based on the number of strings on notes.
... COM rng; COMVariant rowHeightVariant; real rowHeight; ... rng = wks.Range(strFmt("A%1", curRow)); cell.Value2(_route.OprNum); // to keep the current row height rowHeightVariant = rng.RowHeight(); rowHeight = rowHeightVariant.double(); ... //to adjust the row height accordingly to the number of strings in notes rng.RowHeight(rowHeight*this.countLines(notes)); ...
Unfortunately, I had spent so much time trying to understand the reason of errors until I found this posting. Thank you Max!
3 comments:
Is it possible to merge cells in x++
I believe yes if can get access to such a function of the Excel object.
but there is no such method available in x++
Post a Comment