/** * Constructor - used when copying sheets * * @param index the index into the name table */ public NameRecord(CSharpJExcel.Jxl.Read.Biff.NameRecord sr, int ind) : base(Type.NAME) { data = sr.getData(); name = sr.getName(); sheetRef = sr.getSheetRef(); index = ind; modified = false; // Copy the ranges CSharpJExcel.Jxl.Read.Biff.NameRecord.NameRange[] r = sr.getRanges(); ranges = new NameRange[r.Length]; for (int i = 0; i < ranges.Length; i++) { ranges[i] = new NameRange(r[i]); } }
/** * Constructor */ public ButtonPropertySetRecord(CSharpJExcel.Jxl.Read.Biff.ButtonPropertySetRecord bps) : base(Type.BUTTONPROPERTYSET) { data = bps.getData(); }
/** * Constructor * * @param p the palette record */ public PaletteRecord(CSharpJExcel.Jxl.Read.Biff.PaletteRecord p) : base(Type.PALETTE) { data = p.getData(); }
/** * Consructor invoked when copying a spreadsheet * * @param hr the read header record */ public PLSRecord(CSharpJExcel.Jxl.Read.Biff.PLSRecord hr) : base(Type.PLS) { data = hr.getData(); }
/** * Writes out the biff record * @param r * @exception IOException if an error occurs */ private bool writeRecord(CSharpJExcel.Jxl.Read.Biff.Record r, TextWriter os) { bool cont = true; int pos = reader.getPos(); int code = r.getCode(); if (bofs == 0) { cont = (r.getType() == CSharpJExcel.Jxl.Biff.Type.BOF); } if (!cont) { return cont; } if (r.getType() == CSharpJExcel.Jxl.Biff.Type.BOF) { bofs++; } if (r.getType() == CSharpJExcel.Jxl.Biff.Type.EOF) { bofs--; } StringBuilder buf = new StringBuilder(); // Write out the record header writeSixDigitValue(pos, buf); buf.Append(" ["); buf.Append(recordNames[r.getType()]); buf.Append("]"); buf.Append(" (0x"); buf.Append(code.ToString("x")); buf.Append(")"); if (code == CSharpJExcel.Jxl.Biff.Type.XF.value) { buf.Append(" (0x"); buf.Append(xfIndex.ToString("x")); buf.Append(")"); xfIndex++; } if (code == CSharpJExcel.Jxl.Biff.Type.FONT.value) { if (fontIndex == 4) { fontIndex++; } buf.Append(" (0x"); buf.Append(fontIndex.ToString("x")); buf.Append(")"); fontIndex++; } os.Write(buf.ToString()); os.WriteLine(); byte[] standardData = new byte[4]; standardData[0] = (byte)(code & 0xff); standardData[1] = (byte)((code & 0xff00) >> 8); standardData[2] = (byte)(r.getLength() & 0xff); standardData[3] = (byte)((r.getLength() & 0xff00) >> 8); byte[] recordData = r.getData(); byte[] data = new byte[standardData.Length + recordData.Length]; Array.Copy(standardData, 0, data, 0, standardData.Length); Array.Copy(recordData, 0, data, standardData.Length, recordData.Length); int byteCount = 0; int lineBytes = 0; while (byteCount < data.Length) { buf = new StringBuilder(); writeSixDigitValue(pos + byteCount, buf); buf.Append(" "); lineBytes = Math.Min(bytesPerLine, data.Length - byteCount); for (int i = 0; i < lineBytes; i++) { writeByte(data[i + byteCount], buf); buf.Append(' '); } // Perform any padding if (lineBytes < bytesPerLine) { for (int i = 0; i < bytesPerLine - lineBytes; i++) { buf.Append(" "); } } buf.Append(" "); for (int i = 0; i < lineBytes; i++) { char c = (char)data[i + byteCount]; if (c < ' ' || c > 'z') c = '.'; buf.Append(c); } byteCount += lineBytes; os.Write(buf.ToString()); os.WriteLine(); } return cont; }