how to add different sheet in excel through Navision

mitnishantmitnishant Member Posts: 5
edited 2010-09-08 in NAV Three Tier
HI
i need to add different datasheet in same Excel file through Navision, How can i do this.

Thank You

Comments

  • DigiTecKidDigiTecKid Member Posts: 46
    Look at table 370 Excel Buffer, the existing "CreateSheet" function. It basically assigns a name, left & right header, page orientation, then starts pushing in data...

    XlWrkSht.Name := SheetName;
    IF ReportHeader <> '' THEN
    XlWrkSht.PageSetup.LeftHeader :=
    STRSUBSTNO('%1%2%1%3%4',GetExcelReference(1),ReportHeader,CRLF,CompanyName);
    XlWrkSht.PageSetup.RightHeader :=
    STRSUBSTNO(Text006,GetExcelReference(2),GetExcelReference(3),CRLF,UserID2);
    XlWrkSht.PageSetup.Orientation := XlLandscape;
    IF FIND('-') THEN
    REPEAT
    RecNo := RecNo + 1;
    Window.UPDATE(1,ROUND(RecNo / TotalRecNo * 10000,1));
    IF NumberFormat <> '' THEN
    XlWrkSht.Range(xlColID + xlRowID).NumberFormat := NumberFormat;
  • mitnishantmitnishant Member Posts: 5
    this code on preDataitem trigger

    WITH ExcelBuf DO BEGIN
    SetUseInfoSheed;
    AddInfoColumn ('Compname',FALSE,'',TRUE,FALSE,FALSE,'');
    AddInfoColumn ('Compname',FALSE,'',FALSE,FALSE,FALSE,'');
    CreateBook;
    END;

    and this code on "OnAfterGetRecord Trigger

    WITH ExcelBuf DO BEGIN
    ClearNewRow;
    NewRow;
    AddColumn ('No.',FALSE,'',TRUE,FALSE,FALSE,'');
    AddColumn ('Description',FALSE,'',FALSE,FALSE,FALSE,'');
    NewRow;
    AddColumn (Item."No.",FALSE,'',TRUE,FALSE,FALSE,'');
    AddColumn (Item.Description,FALSE,'',TRUE,FALSE,FALSE,'');
    CreateSheet(FORMAT(intCount),'Test Excel',COMPANYNAME,USERID);
    DELETEALL(FALSE);
    intCount += 1;
    END;

    This is on OnPost Report Trigger
    ExcelBuf.GiveUserControl;
Sign In or Register to comment.