Field-Map Scripting

4.6.1.6 OpenInExcel

OpenInExcel procedure


Prototype:

procedure OpenInExcel;

Description:

Opens file in Excel

Syntax:

xls.OpenInExcel;


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class

Return value:

none


See also:

OpenFile, FileName, CloseAndSave, OpenInExcel, Complex example


Example:

Var
  xls :TExcelWrapper;

Begin
  {data preparation}
  //data querying etc...

  {document preparation}  
  xls:=TExcelWrapper.Create;   
  try
    xls.CreateFile(ProjectDir+'ExcelTasks\MyExcelTask');
    
    {managing worksheets}
    {managing formats}
    {setting cell values}
    {etc....}
    
    try 
      xls.CloseAndSave(true);    // save and open file in Excel
      
      {or
      
      xls.ShowExcelPreview('OpenInExcel=0;SaveToExcelFile=0');      // show thumbnail preview
      
       or
      
      xls.CloseAndSave(false);   // save file in Excel
      xls.OpenInExcel(FileName); // open file in Excel
      
      }
    except
      ShowError('Error on saving file.');
    end;     
  finally
    xls.Free;
  end;           
End.