←Select platform

LoadFromFile Method

Summary

Loads an Excel workbook from the specified file path into a LEADWorkbook instance.

Syntax

C#
C++/CLI
Python
public static LEADWorkbook LoadFromFile( 
   string fileName, 
   LoadWorkbookOptions options 
) 
public:  
   static LEADWorkbook^ LoadFromFile( 
      String^ fileName, 
      LoadWorkbookOptions^ options 
   ) 
def LoadFromFile(self,fileName,options): 

Parameters

fileName

A string specifying the complete file path of the Excel workbook to be loaded. The path must be accessible by the application.

options

An instance of LoadWorkbookOptions providing additional settings for loading the workbook.

Return Value

An instance of the LEADWorkbook class loaded with the content from the specified file.

Example

C#
using Leadtools; 
using Leadtools.Document.LEADOffice.Sheet; 
 
 
public void ReadExcelFileExample() 
{ 
   var filePath = Path.Combine(LEAD_VARS.ImagesDir, @"WorkbookTest.xlsx"); 
   // Load an Excel workbook from a file 
   var workbook = LEADWorkbookFactory.LoadFromFile(filePath, new LoadWorkbookOptions()); 
 
   Console.WriteLine("Sheets in the workbook:"); 
   // Iterate over sheets 
   foreach (var sheet in workbook) 
   { 
      Console.WriteLine(sheet.Name); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

LEADWorkbookFactory Class

LEADWorkbookFactory Members

Leadtools.Document.LEADOffice.Sheet Namespace

Help Version 23.0.2024.4.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.LEADOffice Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.