Used to process text templates.

Hierarchy

  • Templater

Methods

generateText

  • generateText(item: RefItem, template: string): Promise<string>
  • The method iterates through a template and fills it out with values from the context of the app item you pass.

    Parameters

    • item: RefItem

      App item.

    • template: string

      Template.

      const item = Context.data.n1!;
      const text = await  System.templater.generateText(item,'test {$__name}'); 
      

    Returns Promise<string>

    Result of iterating with a templater.

parseSpreadsheet

  • The method analyzes .xls, .xlsx, and .csv files.

    Parameters

    Returns Promise<ParseSpreadsheetResponse>

    Pages and only filled out rows and cells.
    Example of calling the analyzer:

    const file_id = file.id
    const options:  ParseSpreadsheetOptions = { 
            separator: ';' 
        }; 
    const text =  await System.templater.parseSpreadsheet(file_id, options); 
    

    The result in JSON:

    {
     'pages': [ 
         { 
             'index': 0, 
              'name': 'Sheet1', 
             'rows': [ 
                 { 
                      'cells': [ 
                         { 
                             'index': 3,  
                             'value': '5' 
                         }  
                     ], 
                     'index': 2 
                 } 
             ]  
         } 
     ] 
    } 
    

    Here pages is a collection of sheets in the file,
    rows is a collection of rows on a sheet, and cells is a collection of cells in a row.