CopySheet functionality in Export to excel

mobilenavmobilenav Member Posts: 6
Hi,

I have created multiple sheets based on locations from NAV using the Excel buffer functionality. Now, i need to copy the rows and columns from one sheet to another similar to copysheet. Is this possible?

Thanks in advance.

Answers

  • AntoniomvallsAntoniomvalls Member Posts: 34
    Add this function to the 370 table:
    AddNewSheet(SheetName : Text[250])
    XlWrkShtWriter := XlWrkBkWriter.AddWorksheet(SheetName);
    IF SheetName <> '' THEN BEGIN
    XlWrkShtWriter.Name := SheetName;
    ActiveSheetName := SheetName;
    END;
    CurrentRow:=0;
    CurrentCol:=0;


    The program flow should be like:

    ExcelBuffer.DELETEALL;
    CLEAR(ExcelBuffer);
    FilenameServer:='';
    ExcelBuffer.CreateBook(FilenameServer,'asdf');
    ExcelBuffer.AddColumn('qwer',FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuffer."Cell Type"::Text);
    ExcelBuffer.AddColumn('zxcv'),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuffer."Cell Type"::Text);
    ExcelBuffer.NewRow;


    ExcelBuffer.WriteSheet('sheet1',COMPANYNAME,USERID);
    ExcelBuffer.DELETEALL;
    ExcelBuffer.AddNewSheet('sheet2');

    ExcelBuffer.AddColumn('p',FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuffer."Cell Type"::Text);
    ExcelBuffer.AddColumn('o',FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuffer."Cell Type"::Text);
    ExcelBuffer.NewRow;

    ExcelBuffer.WriteSheet('Pedidos',COMPANYNAME,USERID);
    ExcelBuffer.DELETEALL;
    ExcelBuffer.AddNewSheet('sheet3');
    .
    .
    .
    .
    .
    .
    .
    .


    Giving thanks is always wellcome
  • mobilenavmobilenav Member Posts: 6
    edited 2018-06-22
    Hi,
    Thanks for the response. This is like we manually insert the data into each sheet through addcolumn. I need something like copying Sheet 1 data to Sheet 2 and so on.
    It should be like copysheet(Sheet1,Sheet2). Can we do Something like this in navision using the excel buffer?

    Thanks in advance
  • AntoniomvallsAntoniomvalls Member Posts: 34
    edited 2018-06-25
    I don't know then but probably not directly… U can use another table like a buffer and from that copy data with my functions but… it is no efficient.

    Excel buffer has his limits xd…

    I wish u lucky
    Giving thanks is always wellcome
Sign In or Register to comment.