Ejemplo n.º 1
0
        // Token: 0x0600016B RID: 363 RVA: 0x00007F54 File Offset: 0x00006F54
        private Bytes WINDOW2()
        {
            Bytes bytes = new Bytes();

            if (this._doc.Workbook.Worksheets.GetIndex(this.Name) == 0)
            {
                bytes.Append(new byte[]
                {
                    182,
                    6
                });
            }
            else
            {
                bytes.Append(new byte[]
                {
                    182,
                    4
                });
            }
            Bytes bytes2 = bytes;

            byte[] array = new byte[16];
            array[4] = 64;
            bytes2.Append(array);
            return(Record.GetBytes(RID.WINDOW2, bytes));
        }
Ejemplo n.º 2
0
 // Token: 0x060000B7 RID: 183 RVA: 0x00005BB0 File Offset: 0x00004BB0
 private Bytes Continue(Bytes sst, Bytes bytes, out int remainingRecordBytes, ref bool isFirstContinue)
 {
     sst.Append(Record.GetBytes(isFirstContinue ? RID.SST : RID.CONTINUE, bytes));
     remainingRecordBytes = 8224;
     isFirstContinue      = false;
     return(new Bytes());
 }
Ejemplo n.º 3
0
        private static Bytes ROW(Row row)
        {
            Bytes bytes = new Bytes();

            //Index of this row
            bytes.Append(BitConverter.GetBytes((ushort)(row.RowIndex - 1)));

            //Index to column of the first cell which is described by a cell record
            bytes.Append(BitConverter.GetBytes((ushort)(row.MinCellCol - 1)));

            //Index to column of the last cell which is described by a cell record, + 1
            bytes.Append(BitConverter.GetBytes(row.MaxCellCol));

            //Height of row in twips, custom row height indicator
            //TODO: Implement Row height and custom height indicators (excelfileformat.pdf p.190)
            bytes.Append(new byte[] { 0x08, 0x01 });

            //Not used
            bytes.Append(new byte[] { 0x00, 0x00 });

            //Not used anymore in BIFF8 (DBCELL instead)
            bytes.Append(new byte[] { 0x00, 0x00 });

            //Option flags and default row formatting
            //TODO: Implement Row option flags and default row formatting (excelfileformat.pdf p.190)
            bytes.Append(new byte[] { 0x00, 0x01, 0x0F, 0x00 });

            return(Record.GetBytes(RID.ROW, bytes));
        }
Ejemplo n.º 4
0
        private Bytes MERGEDCELLS()
        {
            Bytes mergedcells = new Bytes();

            int  areaIndex       = 0;
            int  mergeAreaCount  = _mergeAreas.Count;
            long areasPerRecord  = 1027;
            int  recordsRequired = (int)Math.Ceiling(_mergeAreas.Count / (double)areasPerRecord);

            for (int recordIndex = 0; recordIndex < recordsRequired; recordIndex++)
            {
                ushort blockAreaIndex = 0;
                Bytes  rangeAddresses = new Bytes();
                while (areaIndex < mergeAreaCount && blockAreaIndex < areasPerRecord)
                {
                    rangeAddresses.Append(CellRangeAddress(_mergeAreas[areaIndex]));

                    blockAreaIndex++;
                    areaIndex++;
                }
                rangeAddresses.Prepend(BitConverter.GetBytes(blockAreaIndex));
                mergedcells.Append(Record.GetBytes(RID.MERGEDCELLS, rangeAddresses));
            }

            return(mergedcells);
        }
Ejemplo n.º 5
0
        // Token: 0x06000259 RID: 601 RVA: 0x0000AFD4 File Offset: 0x00009FD4
        private static Bytes ROW(Row row)
        {
            Bytes bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(row.RowIndex - 1));
            bytes.Append(BitConverter.GetBytes(row.MinCellCol - 1));
            bytes.Append(BitConverter.GetBytes(row.MaxCellCol));
            bytes.Append(new byte[]
            {
                8,
                1
            });
            Bytes bytes2 = bytes;

            byte[] byteArray = new byte[2];
            bytes2.Append(byteArray);
            Bytes bytes3 = bytes;

            byte[] byteArray2 = new byte[2];
            bytes3.Append(byteArray2);
            Bytes bytes4 = bytes;

            byte[] array = new byte[4];
            array[1] = 1;
            array[2] = 15;
            bytes4.Append(array);
            return(Record.GetBytes(RID.ROW, bytes));
        }
Ejemplo n.º 6
0
        private Bytes RK(bool trueFalse)
        {
            Bytes rk = new Bytes();

            //Index to row
            rk.Append(BitConverter.GetBytes((ushort)(Row - 1)));

            //Index to column
            rk.Append(BitConverter.GetBytes((ushort)(Column - 1)));

            //Index to XF record
            rk.Append(BitConverter.GetBytes((ushort)_xfIdx));

            //RK Value
            if (Type == CellTypes.Integer)
            {
                rk.Append(RKIntegerValue(Value, trueFalse));
            }
            else if (Type == CellTypes.Float)
            {
                rk.Append(RKDecimalValue(Value, trueFalse));
            }

            return(Record.GetBytes(RID.RK, rk));
        }
Ejemplo n.º 7
0
        // Token: 0x06000147 RID: 327 RVA: 0x000073C0 File Offset: 0x000063C0
        private Bytes LABEL()
        {
            Bytes bytes = new Bytes();

            bytes.Append(this.LABELBase());
            bytes.Append(XlsDocument.GetUnicodeString(((string)this.Value) ?? string.Empty, 16));
            return(Record.GetBytes(RID.LABEL, bytes));
        }
Ejemplo n.º 8
0
        // Token: 0x06000148 RID: 328 RVA: 0x0000740C File Offset: 0x0000640C
        private Bytes LABELSST()
        {
            Bytes bytes = new Bytes();

            bytes.Append(this.LABELBase());
            bytes.Append(BitConverter.GetBytes((uint)this._value));
            return(Record.GetBytes(RID.LABELSST, bytes));
        }
Ejemplo n.º 9
0
        // Token: 0x0600029E RID: 670 RVA: 0x0000C7E4 File Offset: 0x0000B7E4
        private Bytes GetFormatRecord(ushort id, string format)
        {
            Bytes bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(id));
            bytes.Append(XlsDocument.GetUnicodeString(format, 16));
            return(Record.GetBytes(RID.FORMAT, bytes));
        }
Ejemplo n.º 10
0
        // Token: 0x06000146 RID: 326 RVA: 0x00007368 File Offset: 0x00006368
        private Bytes BLANK()
        {
            Bytes bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(this.Row - 1));
            bytes.Append(BitConverter.GetBytes(this.Column - 1));
            bytes.Append(BitConverter.GetBytes((ushort)this._xfIdx));
            return(Record.GetBytes(RID.BLANK, bytes));
        }
Ejemplo n.º 11
0
        private Bytes LABEL()
        {
            Bytes label = new Bytes();

            label.Append(LABELBase());

            //Unicode string, 16-bit string length
            label.Append(XlsDocument.GetUnicodeString((string)Value ?? string.Empty, 16));

            return(Record.GetBytes(RID.LABEL, label));
        }
Ejemplo n.º 12
0
        private Bytes LABELSST()
        {
            Bytes labelsst = new Bytes();

            labelsst.Append(LABELBase());

            //Index of string value in Shared String Table
            labelsst.Append(BitConverter.GetBytes((uint)_value));

            return(Record.GetBytes(RID.LABELSST, labelsst));
        }
Ejemplo n.º 13
0
        // Token: 0x0600014B RID: 331 RVA: 0x0000752C File Offset: 0x0000652C
        private Bytes NUMBER()
        {
            double val   = Convert.ToDouble(this.Value);
            Bytes  bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(this.Row - 1));
            bytes.Append(BitConverter.GetBytes(this.Column - 1));
            bytes.Append(BitConverter.GetBytes((ushort)this._xfIdx));
            bytes.Append(Cell.NUMBERVal(val));
            return(Record.GetBytes(RID.NUMBER, bytes));
        }
Ejemplo n.º 14
0
        private Bytes BLANK()
        {
            Bytes blank = new Bytes();

            //Index to row
            blank.Append(BitConverter.GetBytes((ushort)(Row - 1)));

            //Index to column
            blank.Append(BitConverter.GetBytes((ushort)(Column - 1)));

            //Index to XF record
            blank.Append(BitConverter.GetBytes((ushort)_xfIdx));

            return(Record.GetBytes(RID.BLANK, blank));
        }
Ejemplo n.º 15
0
        // Token: 0x0600016A RID: 362 RVA: 0x00007EC4 File Offset: 0x00006EC4
        private Bytes INDEX(int baseLength)
        {
            Bytes bytes  = new Bytes();
            Bytes bytes2 = bytes;

            byte[] byteArray = new byte[4];
            bytes2.Append(byteArray);
            bytes.Append(BitConverter.GetBytes(this._rows.MinRow - 1U));
            bytes.Append(BitConverter.GetBytes(this._rows.MaxRow));
            bytes.Append(BitConverter.GetBytes(0U));
            for (int i = 1; i < this._dbCellOffsets.Length; i++)
            {
                bytes.Append(BitConverter.GetBytes((uint)(baseLength + this._dbCellOffsets[i])));
            }
            return(Record.GetBytes(RID.INDEX, bytes));
        }
Ejemplo n.º 16
0
        // Token: 0x0600025A RID: 602 RVA: 0x0000B078 File Offset: 0x0000A078
        private static Bytes DBCELL(ushort[] cOff)
        {
            Bytes bytes = new Bytes();

            for (int i = 0; i < cOff.Length; i++)
            {
                if (i == 0)
                {
                    bytes.Append(BitConverter.GetBytes((uint)cOff[i]));
                }
                else
                {
                    bytes.Append(BitConverter.GetBytes(cOff[i]));
                }
            }
            return(Record.GetBytes(RID.DBCELL, bytes));
        }
Ejemplo n.º 17
0
        private Bytes WINDOW2()
        {
            Bytes window2 = new Bytes();

            //TODO: Implement options - excelfileformat.pdf pp.210-211
            if (_doc.Workbook.Worksheets.GetIndex(Name) == 0) //NOTE: This was == 1, but the base of the worksheets collection must have changed
            {
                window2.Append(new byte[] { 0xB6, 0x06 });
            }
            else
            {
                window2.Append(new byte[] { 0xB6, 0x04 });
            }
            window2.Append(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });

            return(Record.GetBytes(RID.WINDOW2, window2));
        }
Ejemplo n.º 18
0
        // Token: 0x0600014A RID: 330 RVA: 0x0000749C File Offset: 0x0000649C
        private Bytes RK(bool trueFalse)
        {
            Bytes bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(this.Row - 1));
            bytes.Append(BitConverter.GetBytes(this.Column - 1));
            bytes.Append(BitConverter.GetBytes((ushort)this._xfIdx));
            if (this.Type == CellTypes.Integer)
            {
                bytes.Append(Cell.RKIntegerValue(this.Value, trueFalse));
            }
            else if (this.Type == CellTypes.Float)
            {
                bytes.Append(Cell.RKDecimalValue(this.Value, trueFalse));
            }
            return(Record.GetBytes(RID.RK, bytes));
        }
Ejemplo n.º 19
0
        private Bytes NUMBER()
        {
            double value = Convert.ToDouble(Value);

            Bytes number = new Bytes();

            //Index to row
            number.Append(BitConverter.GetBytes((ushort)(Row - 1)));

            //Index to column
            number.Append(BitConverter.GetBytes((ushort)(Column - 1)));

            //Index to XF record
            number.Append(BitConverter.GetBytes((ushort)_xfIdx));

            //NUMBER Value
            number.Append(NUMBERVal(value));

            return(Record.GetBytes(RID.NUMBER, number));
        }
Ejemplo n.º 20
0
        // Token: 0x0600016D RID: 365 RVA: 0x00008020 File Offset: 0x00007020
        private Bytes MERGEDCELLS()
        {
            Bytes bytes = new Bytes();
            int   num   = 0;
            int   count = this._mergeAreas.Count;
            long  num2  = 1027L;
            int   num3  = (int)Math.Ceiling((double)this._mergeAreas.Count / (double)num2);

            for (int i = 0; i < num3; i++)
            {
                ushort num4   = 0;
                Bytes  bytes2 = new Bytes();
                while (num < count && (ulong)num4 < (ulong)num2)
                {
                    bytes2.Append(this.CellRangeAddress(this._mergeAreas[num]));
                    num4 += 1;
                    num++;
                }
                bytes2.Prepend(BitConverter.GetBytes(num4));
                bytes.Append(Record.GetBytes(RID.MERGEDCELLS, bytes2));
            }
            return(bytes);
        }
Ejemplo n.º 21
0
        private Bytes INDEX(int baseLength)
        {
            Bytes index = new Bytes();

            //Not used
            index.Append(new byte[] { 0x00, 0x00, 0x00, 0x00 });

            //Index to first used row (0-based)
            index.Append(BitConverter.GetBytes(_rows.MinRow - 1));

            //Index to first row of unused tail of sheet(last row + 1, 0-based)
            index.Append(BitConverter.GetBytes(_rows.MaxRow));

            //Absolute stream position of the DEFCOLWIDTH record
            //TODO: Implement Worksheet.INDEX Absolute stream position of the DEFCOLWIDTH record (not necessary)
            index.Append(BitConverter.GetBytes((uint)0));

            for (int i = 1; i < _dbCellOffsets.Length; i++)
            {
                index.Append(BitConverter.GetBytes((uint)(baseLength + _dbCellOffsets[i])));
            }

            return(Record.GetBytes(RID.INDEX, index));
        }
Ejemplo n.º 22
0
 // Token: 0x0600004F RID: 79 RVA: 0x0000367B File Offset: 0x0000267B
 internal static Bytes GetBytes(byte[] rid, byte[] data)
 {
     return(Record.GetBytes(rid, new Bytes(data)));
 }