Dear Experts,
I have tried searching the topic on how to export to excel but couldn't find any. I have a report (209 : Vendor Purchase List).
and i want to export to excel.
Is there any way that i could export to excel? How can i export it.
Right now i am saving that report as an html and then opening it in excel. but it's not coming proper. I would really appreciate if someone could help me with this.
0
Comments
Exporting to Excel for reports is not build-in. And can be handled trough the workaround you've just described.
Some reports have a build-in Export to Excel option, while others haven't. If you want any of those reports exported to excel directly, then this will require development. This is usually done by the aid of the Excel Buffer.
|To-Increase|
I found "export budget to excel" to be way overloaded with extra code and hard to understand.
Here are the basics:
ExcelBuffer is set as a global temp table
Exporttoexcel is a boolean on the request form to choose to export to Excel or not
Users almost always want it to default to export
Report - OnPreReport()
Report - OnPostReport() this handles the creation of the workbook and worsheet and gives control to the user
ONPRESECTION OF HEADER
ONPRESECTION OF body
Create this function:
EnterCell(RowNo : Integer;ColumnNo : Integer;CellValue : Text[250];Bold : Boolean;UnderLine : Boolean;NumberFormat : Text[30])
These are the basics, a little tedious each time, but make yourself and export to Excel template report and you can copy and paste a lot of the code.
You of course can add more as you learn more or need to do more.
Good Luck
Steve
ExcelBuf.CreateSheet('Name','Name',COMPANYNAME,USERID);
However, the functionality already available in the Excel Buffer is rather limited.
You can have a sheet and a infosheet. The infosheet is mostly used for showing the reportdata, filter, date or execution, ...
But you can always modify excel buffer to add your own functionality to support multiple sheets.
|To-Increase|
http://lmsmfy.com/?q=EXPORT+EXCEL
http://www.BiloBeauty.com
http://www.autismspeaks.org
Also, yes, searching is good, but since I've created a little helper text file for myself and I'm waiting on a huge task to complete here at work, I don't mind a quick cut and paste:
Look at Report 10145 Item Sales By Customer, which utilizes a multi-sheet output
To begin adding Excel printing to a report, you need to add a temporary record variable that points to the Excel Buffer table.
Excel output can be either one sheet or two sheets. In the two sheet output usage, NAV creates an Info sheet and a Data sheet. To begin multiple sheets, use SetUseInfoSheed().
Creation follows a general code format, which builds the Excel workbook before actual output.
It is customary to insert a CurrReport.SHOWOUTPUT(NOT PrintToExcel) statement on each OnPreSection of your report so that a user only gets the Excel Output, or only gets the report.
Common function calls are:
AddInfoColumn and AddColumn use a variable called NumFormat which defines the cell formatting. Here are common examples, a full listing can be found at http://www.ozgrid.com/Excel/CustomFormats.htm
Example code:
Report - OnPreReport() SomeRecord, Body - OnPreSection() section Report - OnPostReport() section
Functions:
Systems Analyst
NAV 2009 R2 (6.00.34463)
Thanks in Advance..