示例#1
0
        public IList <DataElement> LoadData(Action <int, int> progressCallback = null)
        {
            workbook.WorkbookSet.GetLock();
            IList <DataElement> result = new List <DataElement>();

            try
            {
                for (int i = 0; i < workbookNamesCount; i++)
                {
                    if (workbook.Names[i].Visible)
                    {
                        IRange range = workbook.Names[i].RefersToRange;
                        if (range != null)
                        {
                            if (progressCallback != null)
                            {
                                progressCallback(i, workbookNamesCount);
                            }
                            range = range.Intersect(range.Worksheet.UsedRange);
                            result.Add(CreateDataElementFromRange(workbook.Names[i].Name, range));
                        }
                    }
                }
            }
            finally
            {
                workbook.WorkbookSet.ReleaseLock();
            }
            return(result);
        }