Ejemplo n.º 1
0
 internal void LoadFromStream(TXlsxRecordLoader RecordLoader, TProtection Protection, out bool MacroEnabled)
 {
     InitLoading(null, Protection);
     LoadXlsxWorkbook(RecordLoader, out MacroEnabled);
     Globals.Patterns.EnsureRequiredFills(); //after loading... some files might not have style 1.
     EndLoading(Protection, RecordLoader.Encryption, RecordLoader.SST);
 }
Ejemplo n.º 2
0
        private void LoadXlsxWorkbook(TXlsxRecordLoader RecordLoader, out bool MacroEnabled)
        {
            RecordLoader.ReadTheme(Globals.ThemeRecord);
            List <string> ExternalRefs    = new List <string>();
            List <string> NameDefinitions = new List <string>();

            RecordLoader.ReadWorkbook(Globals, ExternalRefs, NameDefinitions, out MacroEnabled);

            RecordLoader.ReadCustomFileProperties(FileProps);
            RecordLoader.ReadCustomXMLData(Globals.CustomXMLData);
            Globals.References.EnsureLocalSupBook(Globals.SheetCount); //Local Supbook is reference [0]
            foreach (string ExternalRef in ExternalRefs)
            {
                RecordLoader.ReadExternalLink(Globals, ExternalRef);
            }

            RecordLoader.LoadNameDefinitions(Globals, NameDefinitions); //shouldn't be done until all boundsheets have been read and external refs too.

            RecordLoader.ReadStyles(Globals);
            RecordLoader.ReadSST();
            RecordLoader.ReadConnections(Globals);

            Globals.EnsureRequiredRecords();
            Loaded = true;

            if (Globals.SheetCount <= 0)
            {
                XlsMessages.ThrowException(XlsErr.ErrExcelInvalid);
            }
            if (RecordLoader.VirtualReader != null)
            {
                RecordLoader.VirtualReader.StartReading();
            }
            for (int i = 0; i < Globals.SheetCount; i++)
            {
                RecordLoader.SwitchSheets();
                RecordLoader.ReadSheet(Globals.SheetRelationshipId(i), FSheets, Globals);
                if (RecordLoader.VirtualReader != null)
                {
                    RecordLoader.VirtualReader.Flush();
                }
            }

            RecordLoader.ReadMacros();
        }