How manually create Excel Template with Sections?

KeeperRUKeeperRU Member Posts: 58
Hello, I investigating Excel Templates..... I wonder, how "Import Template" works?

Table 14919 :
LOCAL LoadSheetSectionHeights(ServerFileName : Text;SheetName : Text)
List := ReportBuilder.GetReportSectionHeights(ServerFileName,SheetName);
FOR I := 0 TO List.Count - 1 DO BEGIN
  SectionInfo := List.Item(I);
  ExcelTemplateSection.INIT;
  ExcelTemplateSection."Template Code" := Code;
  ExcelTemplateSection."Sheet Name" := SheetName;
  ExcelTemplateSection.Name := SectionInfo.Name;
  ExcelTemplateSection.Height := SectionInfo.Height;
  ExcelTemplateSection.INSERT;
END;

I want to Import my own Template, but how NAV find out my Sections Height?
How can I mark my sections in my excel template file? So NAV could properly import it.

Any link on MSDN?

Best Answer

Answers

  • AntidotEAntidotE Member Posts: 61
    edited 2016-04-08
    Would be nice if you leave here info where to look for others who looks for same info later :)
    It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.
  • KeeperRUKeeperRU Member Posts: 58
    To prepare your Excel Template - You should use Named Range in Excel.
    http://www.excel-easy.com/examples/names-in-formulas.html

    For example - any standard NAV report, open Excel Template from NAV and CTRL+F3.

    You should create Names for sections (Header, Body, Footer etc) and fields to export data (SellerName, PostingDate).

    Then you could easily export data from NAV:
    ExcelReportBuilderMgr.AddSection('REPORTHEADER');
    ExcelReportBuilderMgr.AddDataToSection('SellerName',HeaderDetails[1]);
    ......
    

    and so on.

Sign In or Register to comment.