haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Quintiq file version 2.0
#parent: #root
Method ExportExcel (
  structured[String] brokernames,
  structured[BinaryValue] binaryvalues,
  String exportpath
) id:Method_DialogExport_ExportExcel
{
  #keys: '[136682.0.2056294528]'
  Body:
  [*
    // Write the binary data of the respective 
    // file to its export destination
    i := 0;
    
    traverse( brokernames, Elements, brokername )
    {
      broker := select( Domain, EDIDefinitionManager.BrokerDefinitions, broker, broker.Name() = brokername );
      filename := broker.Destination().astype( EDIXLSLinkDefinition ).FileName() 
      binarydata := binaryvalues.Element( i ).AsBinaryData();
      filepath := filename + ".xlsx";
      Application.Download( filepath, binarydata );
      
      i :=i+1;
    }
  *]
}