Ejemplo n.º 1
0
        internal override void SaveToStream(IDataStream Workbook, TSaveData SaveData, int Row)
        {
            if ((SaveData.ExcludedRecords & TExcludedRecords.Version) != 0)
            {
                return;                                                             //Note that this will invalidate the size, but it doesn't matter as this is not saved for real use. We could write blanks here if we wanted to keep the offsets right.
            }
            byte[] ExcelBuild; byte[] ExcelVersion;
            if (SaveData.BiffVersion == TXlsBiffVersion.Excel2003)
            {
                ExcelBuild   = Excel2003Build;
                ExcelVersion = Excel2003Version;
            }
            else
            {
                ExcelBuild   = Excel2007Build;
                ExcelVersion = Excel2007Version;
            }

            Workbook.WriteHeader((UInt16)Id, (UInt16)Data.Length);
            Workbook.WriteRaw(Data, 4);
            Workbook.WriteRaw(ExcelBuild, ExcelBuild.Length);

            Workbook.WriteRaw(ExcelVersion, 1);
            Workbook.WriteRaw(Data, 14, Data.Length - 14);
        }
Ejemplo n.º 2
0
 internal override void SaveToStream(IDataStream Workbook, TSaveData SaveData, int Row)
 {
     Workbook.WriteHeader((UInt16)Id, (UInt16)Data.Length);
     byte[] Pos = new byte[4];
     Array.Copy(Data, 0, Pos, 0, 4);
     Workbook.WriteRaw(Pos, Pos.Length);
     Workbook.Write(Data, 4, Data.Length - 4);
 }
Ejemplo n.º 3
0
 internal override void SaveToStream(IDataStream Workbook, TSaveData SaveData, int Row)
 {
     Workbook.WriteHeader((UInt16)Id, (UInt16)Data.Length);
     Workbook.WriteRaw(Data, Data.Length);
 }
Ejemplo n.º 4
0
        private void SaveToStream(IDataStream DataStream, TSaveData SaveData, int SheetIndex)
        {
            if ((sBOF == null) || (sEOF == null))
            {
                XlsMessages.ThrowException(XlsErr.ErrSectionNotLoaded);
            }

            sBOF.SaveToStream(DataStream, SaveData, 0);
            FileEncryption.SaveFirstPart(DataStream, SaveData); //WriteProt
            if (DataStream.Encryption.Engine != null)           //FilePass
            {
                byte[] Fp = DataStream.Encryption.Engine.GetFilePassRecord();
                DataStream.WriteRaw(Fp, Fp.Length);
            }

            if (IsXltTemplate)
            {
                TTemplateRecord.SaveNewRecord(DataStream);
            }

            FileEncryption.SaveSecondPart(DataStream, SaveData);

            TGlobalRecordSaver g = new TGlobalRecordSaver(DataStream, SaveData);

            g.SaveRecord(CodePage);

            FLel.SaveToStream(DataStream, SaveData, 0);
            TDSFRecord.SaveDSF(DataStream);
            g.SaveRecord(Excel9File);

            if (SheetIndex < 0)
            {
                FBoundSheets.SaveTabIds(DataStream);
            }
            g.SaveRecord(GetMacroRec(ObjProj));
            g.SaveRecord(GetMacroRec(ObNoMacros));
            g.SaveRecord(CodeNameRecord);

            FFnGroups.SaveToStream(DataStream, SaveData, 0);
            g.SaveRecord(OleObjectSize);
            FWorkbookProtection.SaveToStream(DataStream, SaveData);
            foreach (TWindow1Record w1 in Window1)
            {
                g.SaveRecord(w1);
            }
            TBackupRecord.SaveRecord(DataStream, Backup);
            THideObjRecord.SaveRecord(DataStream, HideObj);
            T1904Record.SaveRecord(DataStream, Dates1904);

            TPrecisionRecord.SaveRecord(DataStream, PrecisionAsDisplayed);
            TRefreshAllRecord.SaveRecord(DataStream, RefreshAll);

            g.SaveRecord(BookBool);

            Fonts.SaveToStream(DataStream, SaveData, 0);
            Formats.SaveToStream(DataStream, SaveData, 0);
            StyleXF.SaveAllToStream(DataStream, ref SaveData, CellXF);

            DXF.SaveToStream(DataStream, SaveData, 0);
            Styles.SaveToStream(DataStream, SaveData, 0);
            TableStyles.SaveToStream(DataStream, SaveData, 0);
            g.SaveRecord(Palette);
            g.SaveRecord(ClrtClient);

            PivotCache.SaveToStream(DataStream, SaveData, 0);
            DocRoute.SaveToStream(DataStream, SaveData, 0);

            UserBView.SaveToStream(DataStream, SaveData, 0);
            TUsesELFsRecord.SaveRecord(DataStream, UsesELFs);

            if (SheetIndex < 0)
            {
                FBoundSheets.SaveToStream(DataStream, SaveData);
                MetaData.SaveToStream(DataStream, SaveData, 0);
            }
            else
            {
                FBoundSheets.SaveRangeToStream(DataStream, SaveData, SheetIndex);
            }

            g.SaveRecord(MTRSettings);
            g.SaveRecord(ForceFullCalculation);
            g.SaveRecord(Country);

            FReferences.SaveToStream(DataStream, SaveData);
            FNames.SaveToStream(DataStream, SaveData, 0); //Should be after FBoundSheets.SaveToStream
            RealTimeData.SaveToStream(DataStream, SaveData, 0);
            g.SaveRecord(RecalcId);

            if (SheetIndex < 0)
            {
                FHeaderImages.SaveToStream(DataStream, SaveData);
                FDrawingGroup.SaveToStream(DataStream, SaveData);
            }

            FSST.SaveToStream(DataStream, SaveData);
            WebPub.SaveToStream(DataStream, SaveData, 0);
            g.SaveRecord(WOpt);
            //CrErr is ignored
            g.SaveRecord(BookExt);
            FeatHdr.SaveToStream(DataStream, SaveData, 0);
            DConn.SaveToStream(DataStream, SaveData, 0);
            ThemeRecord.SaveToStream(DataStream, SaveData, 0);
            g.SaveRecord(CompressPictures);
            g.SaveRecord(Compat12);
            g.SaveRecord(GUIDTypeLib);
            FFutureRecords.SaveToStream(DataStream, SaveData, 0);
            sEOF.SaveToStream(DataStream, SaveData, 0);
        }