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.Get(RID.ROW, bytes)); }
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)XFIndex)); //RK Value if (Type == CellTypes.Integer) { rk.Append(RKValInt(Value, trueFalse)); } else if (Type == CellTypes.Float) { rk.Append(RKValDec(Value, trueFalse)); } return(Record.Get(RID.RK, rk)); }
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.Get(RID.WINDOW2, window2)); }
private static Bytes DBCELL(ushort[] cOff) { Bytes dbcell = new Bytes(); for (int i = 0; i < cOff.Length; i++) { if (i == 0) { dbcell.Append(BitConverter.GetBytes((uint)cOff[i])); } else { dbcell.Append(BitConverter.GetBytes(cOff[i])); } } return(Record.Get(RID.DBCELL, dbcell)); }
private Bytes NUMBER() { 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)XFIndex)); //NUMBER Value number.Append(NUMBERVal(Value)); return(Record.Get(RID.NUMBER, number)); }
private Bytes LABEL() { Bytes label = new Bytes(); //Index to row label.Append(BitConverter.GetBytes((ushort)(Row - 1))); //Index to column label.Append(BitConverter.GetBytes((ushort)(Column - 1))); //Index to XF record label.Append(BitConverter.GetBytes((ushort)XFIndex)); //Unicode string, 16-bit string length label.Append(XlsDocument.BinUniStr2((string)Value ?? string.Empty)); return(Record.Get(RID.LABEL, label)); }
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 this (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.Get(RID.INDEX, index)); }