internal Style(XlsDocument doc, XF xf) { _isInitializing = true; _doc = doc; _xf = xf; _isInitializing = false; }
internal ushort Add(XF xf) { _workbook.Fonts.Add(xf.Font); _workbook.Formats.Add(xf.Format); _workbook.Styles.Add(xf.Style); //TODO: What happens if they try to re-add a Default (i.e. non-user) XF? short xfId = GetId(xf); if (xfId == -1) { xfId = (short)_xfs.Count; _xfs.Add((XF)xf.Clone()); } //NOTE: Not documented, but User-defined XFs must have a minimum //index of 16 (0-based). return (ushort)xfId; }
// Token: 0x060001F4 RID: 500 RVA: 0x00009B54 File Offset: 0x00008B54 internal bool Equals(XF that) { return(this._horizontalAlignment == that._horizontalAlignment && this._textWrapRight == that._textWrapRight && this._verticalAlignment == that._verticalAlignment && this._rotation == that._rotation && this._indentLevel == that._indentLevel && this._shrinkToCell == that._shrinkToCell && this._textDirection == that._textDirection && this._cellLocked == that._cellLocked && this._formulaHidden == that._formulaHidden && this._isStyleXF == that._isStyleXF && this._useNumber == that._useNumber && this._useFont == that._useFont && this._useMisc == that._useMisc && this._useBorder == that._useBorder && this._useBackground == that._useBackground && this._useProtection == that._useProtection && this._leftLineStyle == that._leftLineStyle && this._rightLineStyle == that._rightLineStyle && this._topLineStyle == that._topLineStyle && this._bottomLineStyle == that._bottomLineStyle && this._leftLineColor.Equals(that._leftLineColor) && this._rightLineColor.Equals(that._rightLineColor) && this._diagonalDescending == that._diagonalDescending && this._diagonalAscending == that._diagonalAscending && this._topLineColor.Equals(that._topLineColor) && this._bottomLineColor.Equals(that._bottomLineColor) && this._diagonalLineColor.Equals(that._diagonalLineColor) && this._diagonalLineStyle == that._diagonalLineStyle && this._pattern == that._pattern && this._patternColor.Equals(that._patternColor) && this._patternBackgroundColor.Equals(that._patternBackgroundColor) && this.Font.Equals(that.Font) && this.Format.Equals(that.Format) && this.Style.Equals(that.Style)); }
internal bool Equals(XF that) { if (_horizontalAlignment != that._horizontalAlignment) return false; if (_textWrapRight != that._textWrapRight) return false; if (_verticalAlignment != that._verticalAlignment) return false; if (_rotation != that._rotation) return false; if (_indentLevel != that._indentLevel) return false; if (_shrinkToCell != that._shrinkToCell) return false; if (_textDirection != that._textDirection) return false; if (_cellLocked != that._cellLocked) return false; if (_formulaHidden != that._formulaHidden) return false; if (_isStyleXF != that._isStyleXF) return false; if (_useNumber != that._useNumber) return false; if (_useFont != that._useFont) return false; if (_useMisc != that._useMisc) return false; if (_useBorder != that._useBorder) return false; if (_useBackground != that._useBackground) return false; if (_useProtection != that._useProtection) return false; if (_leftLineStyle != that._leftLineStyle) return false; if (_rightLineStyle != that._rightLineStyle) return false; if (_topLineStyle != that._topLineStyle) return false; if (_bottomLineStyle != that._bottomLineStyle) return false; if (!_leftLineColor.Equals(that._leftLineColor)) return false; if (!_rightLineColor.Equals(that._rightLineColor)) return false; if (_diagonalDescending != that._diagonalDescending) return false; if (_diagonalAscending != that._diagonalAscending) return false; if (!_topLineColor.Equals(that._topLineColor)) return false; if (!_bottomLineColor.Equals(that._bottomLineColor)) return false; if (!_diagonalLineColor.Equals(that._diagonalLineColor)) return false; if (_diagonalLineStyle != that._diagonalLineStyle) return false; if (_pattern != that._pattern) return false; if (!_patternColor.Equals(that._patternColor)) return false; if (!_patternBackgroundColor.Equals(that._patternBackgroundColor)) return false; if (!Font.Equals(that.Font)) return false; if (!Format.Equals(that.Format)) return false; if (!Style.Equals(that.Style)) return false; //if (_targetObject != that._targetObject) return false; return true; }
/// <summary> /// Creates a duplicate instance of this XF objet. /// </summary> /// <returns>A duplicate instance of this XF object.</returns> public object Clone() { XF clone = new XF(_doc); clone.Font = (Font)_font.Clone(); #if SILVERLIGHT clone.Format = new string(_format.ToCharArray()); #else clone.Format = (string) _format.Clone(); #endif if (!IsStyleXF) clone.Style = (Style) _style.Clone(); clone.HorizontalAlignment = HorizontalAlignment; clone.TextWrapRight = TextWrapRight; clone.VerticalAlignment = VerticalAlignment; clone.Rotation = Rotation; clone.IndentLevel = IndentLevel; clone.ShrinkToCell = ShrinkToCell; clone.TextDirection = TextDirection; clone.CellLocked = CellLocked; clone.FormulaHidden = FormulaHidden; clone.IsStyleXF = IsStyleXF; clone.UseNumber = UseNumber; clone.UseFont = UseFont; clone.UseMisc = UseMisc; clone.UseBorder = UseBorder; clone.UseBackground = UseBackground; clone.UseProtection = UseProtection; clone.LeftLineStyle = LeftLineStyle; clone.RightLineStyle = RightLineStyle; clone.TopLineStyle = TopLineStyle; clone.BottomLineStyle = BottomLineStyle; clone.LeftLineColor = LeftLineColor; clone.RightLineColor = RightLineColor; clone.DiagonalDescending = DiagonalDescending; clone.DiagonalAscending = DiagonalAscending; clone.TopLineColor = TopLineColor; clone.BottomLineColor = BottomLineColor; clone.DiagonalLineColor = DiagonalLineColor; clone.DiagonalLineStyle = DiagonalLineStyle; clone.Pattern = Pattern; clone.PatternColor = PatternColor; clone.PatternBackgroundColor = PatternBackgroundColor; clone.Target = Target; return clone; }
internal Font(XlsDocument doc, XF xf) : this(doc) { _target = xf; }
/// <summary> /// Adds a new Cell to the Cells collection with the given Row, Column, Value /// and XF (style). If a Cell already exists with the given row and column, /// it is overwritten. /// </summary> /// <param name="cellRow">1-based Row of new Cell.</param> /// <param name="cellColumn">1-based Column of new Cell.</param> /// <param name="cellValue">Value of new Cell.</param> /// <param name="xf">An Xf object describing the style of the cell.</param> /// <returns>The newly added Cell with the given Row, Column, Value and Style.</returns> public Cell Add(int cellRow, int cellColumn, object cellValue, XF xf) { Util.ValidateUShort(cellRow, "cellRow"); Util.ValidateUShort(cellColumn, "cellColumn"); return Add((ushort)cellRow, (ushort)cellColumn, cellValue, xf); }
/// <summary> /// Adds a new Cell to the Cells collection with the given Row, Column, Value /// and XF (style). If a Cell already exists with the given row and column, /// it is overwritten. /// </summary> /// <param name="cellRow">1-based Row of new Cell.</param> /// <param name="cellColumn">1-based Column of new Cell.</param> /// <param name="cellValue">Value of new Cell.</param> /// <param name="xf">An Xf object describing the style of the cell.</param> /// <returns>The newly added Cell with the given Row, Column, Value and Style.</returns> public Cell Add(ushort cellRow, ushort cellColumn, object cellValue, XF xf) { Cell cell = Add(cellRow, cellColumn, cellValue); cell.ExtendedFormat = xf; return cell; }
public FormattingRun(XF xf, ushort startOffset) { _xfId = xf.Id; _startOffset = startOffset; }
// private void AddDefaultFormattedStyleXFs() // { // // } private short GetId(XF xf) { for (short i = 0; i < _xfs.Count; i++) if (_xfs[i].Equals(xf)) return i; return -1; }
private void AddDefaultUserXF() { XF xf = new XF(_doc); xf.CellLocked = true; Add(xf); _defaultUserXf = xf; }
private void AddDefaultStyleXFs() { XF xf = new XF(_doc); xf.IsStyleXF = true; xf.CellLocked = true; //TODO: Is this correct? Default Style XF is CellLocked? what's the origin of this line? _xfs.Add(xf); xf = (XF) xf.Clone(); xf.UseBackground = false; xf.UseBorder = false; xf.UseFont = true; xf.UseMisc = false; xf.UseNumber = false; xf.UseProtection = false; //Gotta have a 16th (index 15) XF for the Default Cell Format... //See excelfileformat.pdf Sec. 4.6.2: The default cell format is always present //in an Excel file, described by the XF record with the fixed index 15 (0-based). //By default, it uses the worksheet/workbook default cell style, described by //the very first XF record (index 0); //Apparently Excel 2003 was okay without it, but 2007 chokes if it's not there. for (int i = 0; i < 15; i++) _xfs.Add((XF) xf.Clone()); }
/// <summary> /// Gets whether the given XF exists in the collection and will be written to the XlsDocument. /// </summary> /// <param name="xf">The XF object to check whether it will be written to the XlsDocument.</param> /// <returns>true if the given XF object will be written to the XlsDocument, false otherwise.</returns> public bool IsWritten(XF xf) { return(GetId(xf) > -1); }
private void AddDefaultUserXF() { XF xf = _doc.NewXF(); Add(xf); }
/// <summary> /// Adds a new Cell to the Cells collection with the given Row, Column, Value /// and XF (style). If a Cell already exists with the given row and column, /// it is overwritten. /// </summary> /// <param name="cellRow">1-based Row of new Cell.</param> /// <param name="cellColumn">1-based Column of new Cell.</param> /// <param name="cellValue">Value of new Cell.</param> /// <param name="xf">An Xf object describing the style of the cell.</param> /// <returns>The newly added Cell with the given Row, Column, Value and Style.</returns> public Cell AddValueCellXF(ushort cellRow, ushort cellColumn, object cellValue, XF xf) { Cell cell = AddValueCell(cellRow, cellColumn, cellValue); cell.XFIndex = xf.Id; return(cell); }
internal bool Equals(XF that) { if (_horizontalAlignment != that._horizontalAlignment) { return(false); } if (_textWrapRight != that._textWrapRight) { return(false); } if (_verticalAlignment != that._verticalAlignment) { return(false); } if (_rotation != that._rotation) { return(false); } if (_indentLevel != that._indentLevel) { return(false); } if (_shrinkToCell != that._shrinkToCell) { return(false); } if (_textDirection != that._textDirection) { return(false); } if (_cellLocked != that._cellLocked) { return(false); } if (_formulaHidden != that._formulaHidden) { return(false); } if (_isStyleXF != that._isStyleXF) { return(false); } if (_useNumber != that._useNumber) { return(false); } if (_useFont != that._useFont) { return(false); } if (_useMisc != that._useMisc) { return(false); } if (_useBorder != that._useBorder) { return(false); } if (_useBackground != that._useBackground) { return(false); } if (_useProtection != that._useProtection) { return(false); } if (_leftLineStyle != that._leftLineStyle) { return(false); } if (_rightLineStyle != that._rightLineStyle) { return(false); } if (_topLineStyle != that._topLineStyle) { return(false); } if (_bottomLineStyle != that._bottomLineStyle) { return(false); } if (!_leftLineColor.Equals(that._leftLineColor)) { return(false); } if (!_rightLineColor.Equals(that._rightLineColor)) { return(false); } if (_diagonalDescending != that._diagonalDescending) { return(false); } if (_diagonalAscending != that._diagonalAscending) { return(false); } if (!_topLineColor.Equals(that._topLineColor)) { return(false); } if (!_bottomLineColor.Equals(that._bottomLineColor)) { return(false); } if (!_diagonalLineColor.Equals(that._diagonalLineColor)) { return(false); } if (_diagonalLineStyle != that._diagonalLineStyle) { return(false); } if (_pattern != that._pattern) { return(false); } if (!_patternColor.Equals(that._patternColor)) { return(false); } if (!_patternBackgroundColor.Equals(that._patternBackgroundColor)) { return(false); } if (!Font.Equals(that.Font)) { return(false); } if (!Format.Equals(that.Format)) { return(false); } if (!Style.Equals(that.Style)) { return(false); } //if (_targetObject != that._targetObject) return false; return(true); }
/// <summary> /// Adds a new Cell to the Cells collection with the given Row, Column, Value /// and XF (style). If a Cell already exists with the given row and column, /// it is overwritten. /// </summary> /// <param name="cellRow">1-based Row of new Cell.</param> /// <param name="cellColumn">1-based Column of new Cell.</param> /// <param name="cellValue">Value of new Cell.</param> /// <param name="xf">An Xf object describing the style of the cell.</param> /// <returns>The newly added Cell with the given Row, Column, Value and Style.</returns> public Cell Add(int cellRow, int cellColumn, object cellValue, XF xf) { Util.ValidateUShort(cellRow, "cellRow"); Util.ValidateUShort(cellColumn, "cellColumn"); return(Add((ushort)cellRow, (ushort)cellColumn, cellValue, xf)); }
///<summary> /// (For internal use only) - Updates this Cell's XF id from the provided XF. ///</summary> ///<param name="fromXF">The XF from which to calculate this Cell's XF id.</param> public void UpdateId(XF fromXF) { _xfIdx = fromXF.Id; }
public Cell AddValueCellXF(ushort cellRow, ushort cellColumn, object cellValue, XF xf) { return(Add(cellRow, cellColumn, cellValue, xf)); }
public Cell AddValueCellXF(ushort cellRow, ushort cellColumn, object cellValue, XF xf) { return Add(cellRow, cellColumn, cellValue, xf); }