Simple way to write export to excel in NAV
Name DataType Subtype Length
ExportToExcel Boolean
ExcelBuffer Record Excel Buffer
i Integer
Copy Entercell function from Standard Reports
1. Write a Code on Report -OnPostReport trigger
IF ExportToExcel THEN BEGIN
ExcelBuffer.CreateBook;
ExcelBuffer.CreateSheet('NAME','',' ',USERID);
ExcelBuffer.AutoFit('A:K');
ExcelBuffer.GiveUserControl;
END;
2.Write following code in First Data item -onPreDataItem
IF ExportToExcel THEN BEGIN
i:=1;
EnterCell(i,1,'Name',TRUE,FALSE,'');
EnterCell(i,12,'Date',TRUE,FALSE,'');
End;
Continue like how many header fields are there.
3. Write the code in onAfterget trigger where You will get data to display.
IF ExportToExcel THEN BEGIN
i+=1;
EnterCell(i,1,Item."No.",FALSE,FALSE,'');
EnterCell(i,2,Item."No. 2",FALSE,FALSE,'@');
End;
Name DataType Subtype Length
ExportToExcel Boolean
ExcelBuffer Record Excel Buffer
i Integer
Copy Entercell function from Standard Reports
1. Write a Code on Report -OnPostReport trigger
IF ExportToExcel THEN BEGIN
ExcelBuffer.CreateBook;
ExcelBuffer.CreateSheet('NAME','',' ',USERID);
ExcelBuffer.AutoFit('A:K');
ExcelBuffer.GiveUserControl;
END;
2.Write following code in First Data item -onPreDataItem
IF ExportToExcel THEN BEGIN
i:=1;
EnterCell(i,1,'Name',TRUE,FALSE,'');
EnterCell(i,12,'Date',TRUE,FALSE,'');
End;
Continue like how many header fields are there.
3. Write the code in onAfterget trigger where You will get data to display.
IF ExportToExcel THEN BEGIN
i+=1;
EnterCell(i,1,Item."No.",FALSE,FALSE,'');
EnterCell(i,2,Item."No. 2",FALSE,FALSE,'@');
End;