Example #1
0
        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());
            }
        }
Example #2
0
        // Token: 0x0600028F RID: 655 RVA: 0x0000C0F8 File Offset: 0x0000B0F8
        private void AddDefaultStyleXFs()
        {
            XF xf = new XF(this._doc);

            xf.IsStyleXF  = true;
            xf.CellLocked = true;
            this._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;
            for (int i = 0; i < 15; i++)
            {
                this._xfs.Add((XF)xf.Clone());
            }
        }
Example #3
0
        // Token: 0x0600028E RID: 654 RVA: 0x0000C074 File Offset: 0x0000B074
        internal ushort Add(XF xf)
        {
            this._workbook.Fonts.Add(xf.Font);
            this._workbook.Formats.Add(xf.Format);
            this._workbook.Styles.Add(xf.Style);
            short num = this.GetId(xf);

            if (num == -1)
            {
                num = (short)this._xfs.Count;
                this._xfs.Add((XF)xf.Clone());
            }
            return((ushort)num);
        }
Example #4
0
        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);
        }
Example #5
0
        /// <summary>
        /// Adds an XF object to this collection and returns its id.
        /// </summary>
        /// <param name="xf">The XF object to add to this collection.</param>
        /// <returns>The id of the added XF object.</returns>
        public ushort Add(XF xf)
        {
            short xfId = GetId(xf);

            if (xfId == -1)
            {
                _workbook.Fonts.Add(xf.Font);
                _workbook.Formats.Add(xf.Format);
                _workbook.Styles.Add(xf.Style);
                xfId = (short)_xfs.Count;
                _xfs.Add((XF)xf.Clone());
            }

            //NOTE: Not documented, but User-defined XFs must have a minimum
            //index of 15 (0-based).  This one stumped me for 4-6 hours.  Finally
            //found a clue to this in the source of the gnumeric project on
            //koders.com

            return((ushort)(xfId + 14));
        }
Example #6
0
        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;
        }
Example #7
0
        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());
        }