ComponentOne Excel for .NET
C1.Excel Assembly / C1.Excel Namespace / C1XLBook Class / Progress Event
Example

In This Topic
    Progress Event
    In This Topic
    Fired while data is being read from or written into a workbook.
    Syntax
    'Declaration
     
    Public Event Progress As XLProgressEventHandler
    public event XLProgressEventHandler Progress
    Event Data

    The event handler receives an argument of type XLProgressEventArgs containing data related to this event. The following XLProgressEventArgs properties provide information specific to this event.

    PropertyDescription
    Gets the current done percent of the workbook being loaded or saved.  
    Remarks
    This event is typically used to update the application UI during lengthy operations. It can also be used to cancel the operations.
    Example
    The code below writes messages to the output window while the application Excel files.
    void Load()
    {
    	// create workbook
    	C1XLBook book = new C1XLBook();
                 
    	// progress event handler
    	book.Progress += new XLProgressEventHandler(load_Progress);
                 
    	// load workbook
    	book.Load(xlFileName);
    }
                 
    // print messages while workbook are loaded
    void load_Progress(object sender, XLProgressEventArgs e)
    {
    	Console.WriteLine("Loading {0}, {1:p0} done",
    		e.FileName, e.Position/(float)e.FileLength);
    }
    See Also