internal void AddBiff8Record(TColInfoRecord R) { //Excel can save a column 0x100 in a range, for example (1:0x100) and 0x100 will be used for the default column. //BUT, having a range 0x100:0x100 will crash Excel 2000 when closing, and have warning in Excel 2003!! //So, if the default column is not in the same format as the last column, it cannot be saved. Excel doesn't do it either, //and if you save a file with last column different from default col, close it and reopen, the default col will be gone. int LastColumn = R.LastColumn; if (LastColumn == FlxConsts.Max_Columns97_2003 + 1) { DefaultColumn = new TColInfo(R.Width, R.XF, R.Options, true); LastColumn--; } if (R.FirstColumn < 0 || LastColumn > FlxConsts.Max_Columns97_2003 || R.FirstColumn > LastColumn) { return; } for (int i = R.FirstColumn; i <= LastColumn; i++) { Add(i, new TColInfo(R.Width, R.XF, R.Options, true)); } }
internal void CopyFrom(TColInfoList aColInfoList) { DefColWidthChars = aColInfoList.DefColWidthChars; DefColWidthChars256 = aColInfoList.DefColWidthChars256; if (aColInfoList.FColumns == FColumns) { XlsMessages.ThrowException(XlsErr.ErrInternal); //Should be different objects } if (aColInfoList.DefaultColumn != null) { DefaultColumn = new TColInfo(aColInfoList.DefaultColumn.Width, aColInfoList.DefaultColumn.XF, aColInfoList.DefaultColumn.Options, true); } for (int i = FColumns.Length - 1; i >= 0; i--) { TColInfo[] a = aColInfoList.FColumns[i]; if (a != null) { FColumns[i] = new TColInfo[a.Length]; for (int k = a.Length - 1; k >= 0; k--) { if (a[k] != null) { FColumns[i][k] = new TColInfo(a[k].Width, a[k].XF, a[k].Options, true); } } } } }
internal bool IsEqual(TColInfo aColInfo) { if (aColInfo == null) { return(false); } return // don't compare the column .... (Column = aColInfo.Column) and ((FWidth == aColInfo.Width) && (XF == aColInfo.XF) && (Options == aColInfo.Options)); }
internal void ChangeStandardWidth(int OldStdValue, int NewStdValue, bool BeforeWas256) { for (int i = 0; i < FColumns.Length; i++) { if (FColumns[i] != null) { for (int k = 0; k < FColumns[i].Length; k++) { TColInfo Col = FColumns[i][k]; if (Col != null) { Col.ChangeStandardWidth(OldStdValue, NewStdValue, BeforeWas256); } } } } }
internal void CopyCols(TXlsCellRange SourceRange, int DestCol, int aColCount, TSheetInfo SheetInfo) { //ArrangeInsertCols(SourceRange.Offset(SourceRange.Top, DestCol), aColCount, SheetInfo); //This has already been called. for (int k = 0; k < aColCount; k++) { for (int i = SourceRange.Left; i <= SourceRange.Right; i++) { TColInfo C = this[i]; int NewCol = DestCol + i - SourceRange.Left + k * SourceRange.ColCount; if (C != null && NewCol >= 0 && NewCol <= FlxConsts.Max_Columns + 1) { this[NewCol] = new TColInfo(C.Width, C.XF, C.Options, true); } } } }
private static bool IsEqual(TColInfo a, TColInfo b) { if (a == null) { if (b == null) { return(true); } return(false); } //a != null if (b == null) { return(false); } return(a.IsEqual(b)); }
internal void KeepColsTogether(int Col1, int Col2, int Level, bool replaceLowerLevels) { for (int Col = Col1; Col < Col2; Col++) //Col2 is not included. { if (this[Col] == null) { if (Level == 0) { continue; } this[Col] = new TColInfo(DefColWidth, FlxConsts.DefaultFormatId, 0, true); } if (replaceLowerLevels || this[Col].KeepTogether < Level) { this[Col].KeepTogether = Level; } } }
internal void Add(int Column, TColInfo a) { if (Column < 0 || Column > FlxConsts.Max_Columns + 1) { return; } TColInfo[] Buck = FColumns[Column / Buckets]; if (a == null) { if (Buck == null) { return; } } if (Buck == null) { FColumns[Column / Buckets] = new TColInfo[Buckets]; } FColumns[Column / Buckets][Column % Buckets] = a; }
internal void MarkColForAutofit(int Col, bool Autofit, float Adjustment, int AdjustmentFixed, int MinWidth, int MaxWidth, bool IsMerged) { if (this[Col] == null) { Add(Col, new TColInfo(DefColWidth, FlxConsts.DefaultFormatId, 0, true)); } TColInfo ColInfo = this[Col]; if (IsMerged) { ColInfo.HasMergedCell = Autofit; } else { ColInfo.MarkforAutofit = Autofit; } ColInfo.AutofitAdjustment = Adjustment; ColInfo.AutofitAdjustmentFixed = AdjustmentFixed; ColInfo.MinWidth = MinWidth; ColInfo.MaxWidth = MaxWidth; }
internal void CalcGuts(TGutsRecord Guts) { int MaxGutLevel = 0; for (int i = 0; i < FColumns.Length; i++) { if (FColumns[i] != null) { for (int k = 0; k < FColumns[i].Length; k++) { TColInfo Col = FColumns[i][k]; if (Col != null) { int GutLevel = Col.GetColOutlineLevel(); if (GutLevel > MaxGutLevel) { MaxGutLevel = GutLevel; } } } } } Guts.ColLevel = MaxGutLevel; }