public void EnsureRequiredRecords() { if (sBOF == null) { sBOF = TBOFRecord.CreateEmptyWorkbook(4); } if (sEOF == null) { sEOF = new TEOFRecord(); } if (Window1 == null) { Window1 = new TWindow1Record[1]; Window1[0] = new TWindow1Record(); } CellXF.EnsureMinimumCellXFs(this); StyleXF.EnsureMinimumStyles(Styles, this); }
internal int AddStyleFormat(TFlxFormat format, string StyleName) { if (!format.IsStyle) { format = (TFlxFormat)format.Clone(); format.IsStyle = true; } int OldFmt = Styles.GetStyle(StyleName); if (OldFmt >= 0 && OldFmt < StyleXF.Count) { TXFRecord XF1 = new TXFRecord(format, OldFmt == 0, this, false); StyleXF[OldFmt] = XF1; CellXF.UpdateChangedStyleInCellXF(OldFmt, XF1, false); return(OldFmt); } TXFRecord XFRec = new TXFRecord(format, false, this, false); StyleXF.Add(XFRec); return(StyleXF.Count - 1); }
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); }
internal long TotalSize(TEncryptionData Encryption, bool Repeatable, int SheetIndex) { return (FileEncryption.TotalSize() + Encryption.TotalSize() + TTemplateRecord.GetSize(FIsXltTemplate) + ts(CodePage) + FLel.TotalSize + TDSFRecord.StandardSize() + ts(Excel9File) + (SheetIndex < 0 ? FBoundSheets.TabIdsTotalSize() : 0) + ts(GetMacroRec(ObjProj)) + ts(GetMacroRec(ObNoMacros)) + ts(CodeNameRecord) + FFnGroups.TotalSize + ts(OleObjectSize) + FWorkbookProtection.TotalSize() + ts(Window1) + TBackupRecord.StandardSize() + THideObjRecord.StandardSize() + T1904Record.StandardSize() + TPrecisionRecord.StandardSize() + TRefreshAllRecord.StandardSize() + ts(BookBool) + Fonts.TotalSize + Formats.TotalSize + StyleXF.SizeWithXFExt(this, CellXF) + DXF.TotalSize + Styles.TotalSize + TableStyles.TotalSize + ts(Palette) + ts(ClrtClient) + PivotCache.TotalSize + DocRoute.TotalSize + UserBView.TotalSize + TUsesELFsRecord.StandardSize() + (SheetIndex < 0 ? FBoundSheets.TotalSize() + MetaData.TotalSize : FBoundSheets.TotalRangeSize(SheetIndex) ) + ts(MTRSettings) + ts(ForceFullCalculation) + ts(Country) + FReferences.TotalSize() + FNames.TotalSize + RealTimeData.TotalSize + ts(RecalcId) + (SheetIndex < 0 ? FHeaderImages.TotalSize() + FDrawingGroup.TotalSize() : 0) + FSST.TotalSize(Repeatable) + WebPub.TotalSize + ts(WOpt) + //CrErr is ignored ts(BookExt) + FeatHdr.TotalSize + DConn.TotalSize + ts(ThemeRecord) + ts(CompressPictures) + ts(Compat12) + ts(GUIDTypeLib) + FFutureRecords.TotalSize); }