Hi All
following example will show how to export to excel using automation variables, create a new report and place the code in respective triggers and create automation variables and run report
Variables you need
Name Data Type SubType
1.Excel Automation 'Microsoft Excel 12.0 Object Library'.Application
2.Book Automation 'Microsoft Excel 12.0 Object Library'.Workbook
3.Range Automation 'Microsoft Excel 12.0 Object Library'.Range
4.Sheet Automation 'Microsoft Excel 12.0 Object Library'.Worksheet
5.I Integer
6.J Text
Now place the following code at respective triggers
OnPreDataItem() {To Create work sheet}
CREATE(Excel);
Excel.Visible(TRUE);
Book:=Excel.Workbooks.Add(-4167);
Sheet:=Excel.ActiveSheet;
Sheet.Name := 'Customer List';
OnAfterGetRecord() {To assign Values to the excel cells}
Sheet.Range('A'+j).Value := Customer."No.";
Sheet.Range('B'+j).Value := Customer.Name;
j:=INCSTR(j);
OnInitReport();
j:='1';
Now Design your report and run.Thanks
Jerome Marshal.J
following example will show how to export to excel using automation variables, create a new report and place the code in respective triggers and create automation variables and run report
Variables you need
Name Data Type SubType
1.Excel Automation 'Microsoft Excel 12.0 Object Library'.Application
2.Book Automation 'Microsoft Excel 12.0 Object Library'.Workbook
3.Range Automation 'Microsoft Excel 12.0 Object Library'.Range
4.Sheet Automation 'Microsoft Excel 12.0 Object Library'.Worksheet
5.I Integer
6.J Text
Now place the following code at respective triggers
OnPreDataItem() {To Create work sheet}
CREATE(Excel);
Excel.Visible(TRUE);
Book:=Excel.Workbooks.Add(-4167);
Sheet:=Excel.ActiveSheet;
Sheet.Name := 'Customer List';
OnAfterGetRecord() {To assign Values to the excel cells}
Sheet.Range('A'+j).Value := Customer."No.";
Sheet.Range('B'+j).Value := Customer.Name;
j:=INCSTR(j);
OnInitReport();
j:='1';
Now Design your report and run.Thanks
Jerome Marshal.J
No comments:
Post a Comment