want to print report in excel format via navision

shweta
Member Posts: 94
Hi Everyone
I want to print report in Excel format where columns in excel can change dynamically. what is the process of this
I want to print report in Excel format where columns in excel can change dynamically. what is the process of this
0
Comments
-
use excel buffer table or you can create your own by using automation, do the search, there's a lot of thread here regarding your concern.Sendoh
be smart before being a clever.0 -
here's the link http://www.mibuso.com/forum/viewtopic.php?t=12014Sendoh
be smart before being a clever.0 -
with the using of excel buffer table
create an object of excel buffer table type record. and use these table's function to export data into excel but,
you can use excel automation object to export report in excel.
Create following automation object for example create blank report.
enter following dataitem.
DataItem Name
Purchase Header <Purchase Header>
Purchase Line <Purchase Line>
Name DataType Subtype Length
xlapp Automation Unknown Automation Server.Application
xlwbook Automation Unknown Automation Server.Workbook
xlsheet Automation Unknown Automation Server.Worksheet
xlrange Automation Unknown Automation Server.Range
ctr Integer
Descr Text 150
ctr1 Integer
sn Integer
testFilter Text 100
enter code in onprereport trigger.
sn:=0;
testFilter := "Purchase Header".GETFILTERS;
CREATE(xlapp);
xlwbook :=xlapp.Workbooks.Add;
xlsheet :=xlwbook.Worksheets.Add;
xlsheet.Name:='TEST Report';
xlapp.Visible := TRUE;
xlsheet.Range('A1').Value := 'Vendor Name';
xlsheet.Range('A2').Value := 'SNo';
xlsheet.Range('B2').Value := 'Item No';
xlsheet.Range('C2').Value := 'description';
xlsheet.Range('D2').Value := 'Quantity';
xlsheet.Range('E2').Value := 'Qty to Receive';
//xlsheet.Range('F1').Value := 'Quality';
//xlsheet.Range('G1').Value := 'Cut';
//xlsheet.Range('H1').Value := 'Size';
//xlsheet.Range('I1').Value := 'Unit Cost';
//xlsheet.Range('J1').Value := 'Qty pcs';
//xlsheet.Range('K1').Value := 'Location';
xlsheet.Range('A1:H1').Font.Bold := TRUE;
xlsheet.Range('D1:DD1').NumberFormat :=0.00;
xlsheet.Range('E1:EE1').NumberFormat :=0.00;
write following code in purchase header presection
ctr :=ctr+1;
//xlsheet.Range('A2'+FORMAT(ctr+1)).Value :="Buy-from Vendor No.";
xlsheet.Range('C1').Value :="Buy-from Vendor No.";
//xlsheet.Range('B'+FORMAT(ctr1+1)).Value := "No.";
//xlsheet.Range('C'+FORMAT(ctr1+1)).Value := Description;
//xlsheet.Range('D'+FORMAT(ctr1+1)).Value := FORMAT(Quantity);
//xlsheet.Range('E'+FORMAT(ctr1+1)).Value :=FORMAT("Qty. to Receive");
write follwing code in purchase line presection
sn:=sn+1;
//
excel printing
ctr :=ctr+1;
xlsheet.Range('A'+FORMAT(ctr+1)).Value :=sn;
xlsheet.Range('B'+FORMAT(ctr+1)).Value := "No.";
xlsheet.Range('C'+FORMAT(ctr+1)).Value := Description;
xlsheet.Range('D'+FORMAT(ctr+1)).Value := FORMAT(Quantity);
xlsheet.Range('E'+FORMAT(ctr+1)).Value :=FORMAT("Qty. to Receive");
and chenge the report property processing only to yes
then run the report u will find that data will be exported in excel.
i hope it will be help full.Experience Makes Man Perfect....
Rajesh Patel0 -
create a function and assign RowNo ,ColumnNo and Cell Value asText into Excel Buffer table using Validate function.
fun(RNo,CNo,Value)
ExcelBuffer.validate(RowNo,RNo);
ExcelBuffer.validate(ColumnNo,CNo);
ExcelBuffer.validate(CellValueAsText,Value);
ExcelBuffer.insert;
Take one global variable Rowno , increament it whenever a new record is generated in the report then call that function in this way
fun(Rowno,1,<val>);
.....
in OnPostReport write
ExcelBuffer.createbook
ExcelBuffer.createsheet
ExcelBuffer.giveusercontrol0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions