Export to multiple sheet in excel using Excel Buffer table.

need some help in exporting data using excel buffer in nav 2009 but to multiple sheets in same excel file. any idea how to do this? For Example I want to have one sheet per vendor & want to export first Vendor legder's Entry No. to excel in each sheet. codes are here -
IF vendor.FINDSET THEN REPEAT
gin_row := 0;
grc_ExcelbufferTMP.DELETEALL;
IF Vendorledger.FINDSET THEN BEGIN
EnterCell(1, 1, FORMAT(vendorledger."Entry No."), FALSE, FALSE, FALSE, 0);
END;
ExcelbufferTMP.CreateBook;
ExcelbufferTMP.AddNewSheet;
ExcelbufferTMP.CreateSheet(vendor.name.Name,Text001,COMPANYNAME,USERID);
ExcelbufferTMP.GiveUserControl;
UNTIL vendor.NEXT = 0;

Comments

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Each call to ExcelbufferTMP.CreateSheet(..) will create a separate worksheet.

    So the code may look like this:
    ExcelbufferTMP.CreateBook;
    
    IF vendor.FINDSET THEN 
    REPEAT
      ExcelbufferTMP.DELETEALL;
      ExcelbufferTMP.SetCurrent(0,0);
    
      // populate ExcelbufferTMP table here
     
      ExcelbufferTMP.CreateSheet(..)
    UNTIL vendor.NEXT = 0;
    
    ExcelbufferTMP.GiveUserControl;
    

    Make sure each worksheet has unique name.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.