Export to excel

mitnishantmitnishant Member Posts: 5
edited 2010-09-27 in NAV Three Tier
hi
I need to create a report, which export all data of the particular report in separate sheets of the same workbook in excel.

means if i have two field like "No. " ans description, then

i need separate sheet for each "No." and "description."

No. Description
A1 abcdef
in one sheet

A2 123456
in another sheet in the same Excel .

Comments

  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    And the issue is...?
    Bardur Knudsen
    Microsoft - Dynamics NAV
  • gvolkovgvolkov Member Posts: 196
    Create another sheet and put the data wherever required.

    If Excel.CreateAnotherSheet THEN
    InsertData INTO WHERE Required();

    =D>
    Microsoft Certified Technology Specialist
    Microsoft Certified Business Management Solutions Professional
    Microsoft Certified Business Management Solutions Specialist

    http://www.navisiontech.com
  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    There are some good examples in codeunit 424 Export Analysis View.
    For example, adding a sheet:

    xlApp.ActiveWorkbook.Sheets.Add();
    xlWorkSheet3 := xlApp.ActiveSheet;
    xlWorkSheet3.Name := FORMAT(Text002) + CONVERTSTR("Analysis View Code",' -+','___');
    xlWorkSheet3.Range('A1').Value := AnalysisView.TABLECAPTION;
    xlWorkSheet3.Range('B2').Value := Rec.FIELDCAPTION("Analysis View Code");

    ... and so on.
    Bardur Knudsen
    Microsoft - Dynamics NAV
  • bangswitbangswit Member Posts: 265
    after successful export to excel, it usually open that excel file
    how to make after the export, the excel file doesn't opened automatically?
    thanks
  • geronimogeronimo Member Posts: 90
    bangswit wrote:
    after successful export to excel, it usually open that excel file
    how to make after the export, the excel file doesn't opened automatically?
    thanks
    you could keep the visible property of the xlapp to false and quit it when done by using it
    some example of this can be seen in the excel buffer table

    for example:
    XlApp.Visible(FALSE); //when creating the xlapp variable

    //when finished exporting
    XlWrkBk.Close(FALSE);
    XlApp.Quit;
Sign In or Register to comment.