Search Results for

    Show / Hide Table of Contents

    ExcelFile.VirtualMode Property

    Set this value to true to turn Virtual Mode on. Look at 'Virtual mode' in the Performance Guide for more information.

    Syntax

    Namespace: FlexCel.Core

    public Boolean VirtualMode { get; set; }

    Examples

    You can find a full example of Virtual mode in the sample: 10.API\22.Virtual Mode But here we will show a simpler example which reads only the first row of cells from the first sheet and then exits.

        static void ReadFirstRowOfAllSheets(string fileName)
        {
            XlsFile xls = new XlsFile(); //Create the object but don't open the file yet.
            xls.VirtualMode = true;  //Set the mode to Virtual.
            xls.VirtualCellRead += (sender, e) =>
            {
                if (e.Cell.Row > 1)
                {
                    if (e.Cell.Sheet < e.SheetNames.Length) e.NextSheet = e.SheetNames[e.Cell.Sheet]; //Stop reading this sheet, move to the next.
                    else e.NextSheet = null; //Stop reading the file.
                }
                else
                {
                    Console.WriteLine("Cell: " + new TCellAddress(e.SheetNames[e.Cell.Sheet - 1], e.Cell.Row, e.Cell.Col, false, false).CellRef);
                    Console.Write("Value: ");
                    Console.WriteLine(e.Cell.Value);
                }
            };
            xls.Open(fileName);
        }
    

    See also

    • ExcelFile
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com