On the Report Comment Line I have added code to export to Excel. I am trying for the first time to utilize the following code.
Report line of code call
NewRow := NewRow + 1;
NewColumn := NewColumn + 1;
ExcelBuf.AddCell(NewRow, NewColumn,'Customer Comments',FALSE,TRUE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text,'',0);
ExcelBuffer – Function
AddCell(CurrentRow_1 : Integer;CurrentCol_1 : Integer;Value : Variant;IsFormula : Boolean;IsBold : Boolean;IsItalics : Boolean;IsUnderline : Boolean;NumFormat : Text[30];CellType : 'Number,Text,Date,Time';Font : Text;FontSize : Integer)
GlobalRowNo := CurrentRow_1;
GlobalColumnNo := CurrentCol_1;
XlWrkShtDotNet.Cell(GlobalRowNo,GlobalColumnNo).Style.Font.Bold := IsBold;
Variable –
Name DataType Subtype
XlWrkShtDotNet DotNet ClosedXML.Excel.IXLWorksheet.'ClosedXML, Version=0.59.0.0,
Culture=neutral, PublicKeyToken=fd1eb21b62ae805b'
As soon as the following line is read ...
XlWrkShtDotNet.Cell(GlobalRowNo,GlobalColumnNo).Style.Font.Bold := IsBold;
I receive the following error
This message is for C/AL programmers: A DotNet variable has not been instantiated. Attempting to call ClosedXML.Excel.IXL.Worksheet.Cell in the Excel Buffer_CloseXML:AddCell
Can anyone help me please.
[-o<
0
Comments
Manish
I am a beginner in the DotNet world. I am asking for help.
I did create the variable before writing the code.
How does one check the dot net variable is created first? I read the How To Call.Net but I do not understand it.
Normally I am not that dumb. the light bulb is just not coming on.
Please help.
[-o<
On The How To...
I listed my code in the original post
MyVariableName.ConstructorName(arguments);
XlWrkShtDotNet.Cell(GlobalRowNo,GlobalColumnNo).Style.Font.Bold := IsBold;
Variable –
Name DataType Subtype
XlWrkShtDotNet DotNet ClosedXML.Excel.IXLWorksheet.'ClosedXML, Version=0.59.0.0,
Culture=neutral, PublicKeyToken=fd1eb21b62ae805b'
When I used the C/AL Symbol Menu There was no Constructor listed. But the code did complie
I know I have missed something but I do not know what it is.
you may instantiate your dotnet variable like following:-
XMLWhiteCharCheck := XMLWhiteCharCheck.XMLCharWhiteList;
XlWrkBkDotNet := XlWrkBkDotNet.XLWorkbook();
you also refer following link for the same issue:-
http://www.dynamics.is/?p=706