/** * Constructor * * @param t the record */ public CalcModeRecord(Record t) : base(t) { byte[] data = t.getData(); int mode = IntegerHelper.getInt(data[0],data[1]); automatic = (mode == 1); }
/** * Constructs this object * * @param t the raw data * @param fr the formatting records * @param si the sheet */ public ErrorRecord(Record t,FormattingRecords fr,SheetImpl si) : base(t,fr,si) { byte[] data = getRecord().getData(); errorCode = data[6]; }
/** * Constructs this object from the raw data * * @param t the raw data */ public NineteenFourRecord(Record t) : base(t) { byte[] data = getRecord().getData(); nineteenFour = data[0] == 1 ? true : false; }
/** * Constructs the def col width from the raw data * * @param t the raw data */ public DefaultColumnWidthRecord(Record t) : base(t) { byte[] data = t.getData(); width = IntegerHelper.getInt(data[0],data[1]); }
/** * Constructs the value from the raw data * * @param pgl the raw data */ public PrintHeadersRecord(Record ph) : base(ph) { byte[] data = ph.getData(); printHeaders = (data[0] == 1 ? true : false); }
/** * Constructor */ public DataValidityListRecord(Record t) : base(t) { data = getRecord().getData(); objectId = (uint)IntegerHelper.getInt(data[10],data[11],data[12],data[13]); numSettings = IntegerHelper.getInt(data[14],data[15],data[16],data[17]); }
/** * Constructs this object from the raw data * * @param t the raw data * @param ws the workbook settings */ public ExternalSheetRecord(Record t, WorkbookSettings ws) : base(t) { byte[] data = getRecord().getData(); int numxtis = IntegerHelper.getInt(data[0],data[1]); if (data.Length < numxtis * 6 + 2) { xtiArray = new XTI[0]; //logger.warn("Could not process external sheets. Formulas may be compromised."); return; } xtiArray = new XTI[numxtis]; int pos = 2; for (int i = 0; i < numxtis; i++) { int s = IntegerHelper.getInt(data[pos],data[pos + 1]); int f = IntegerHelper.getInt(data[pos + 2],data[pos + 3]); int l = IntegerHelper.getInt(data[pos + 4],data[pos + 5]); xtiArray[i] = new XTI(s,f,l); pos += 6; } }
/** * Constructs this object from the raw data * * @param t the raw data * @param s the sheet */ public MergedCellsRecord(Record t, Sheet s) : base(t) { byte[] data = getRecord().getData(); int numRanges = IntegerHelper.getInt(data[0],data[1]); ranges = new Range[numRanges]; int pos = 2; int firstRow = 0; int lastRow = 0; int firstCol = 0; int lastCol = 0; for (int i = 0; i < numRanges; i++) { firstRow = IntegerHelper.getInt(data[pos],data[pos + 1]); lastRow = IntegerHelper.getInt(data[pos + 2],data[pos + 3]); firstCol = IntegerHelper.getInt(data[pos + 4],data[pos + 5]); lastCol = IntegerHelper.getInt(data[pos + 6],data[pos + 7]); ranges[i] = new SheetRangeImpl(s,firstCol,firstRow, lastCol,lastRow); pos += 8; } }
/** * Constructor */ public ConditionalFormatRangeRecord(Record t) : base(t) { initialized = false; modified = false; data = getRecord().getData(); }
/** * Constructor * * @param t the record */ public RefreshAllRecord(Record t) : base(t) { byte[] data = t.getData(); int mode = IntegerHelper.getInt(data[0],data[1]); refreshAll = (mode == 1); }
/** * Constructor * * @param t the record */ public WindowProtectedRecord(Record t) : base(t) { byte[] data = t.getData(); int mode = IntegerHelper.getInt(data[0],data[1]); windowProtected = (mode == 1); }
/** * Constructs the value from the raw data * * @param pgl the raw data */ public PrintGridLinesRecord(Record pgl) : base(pgl) { byte[] data = pgl.getData(); printGridLines = (data[0] == 1 ? true : false); }
/** * Constructor * * @param t the record */ public SaveRecalcRecord(Record t) : base(t) { byte[] data = t.getData(); int mode = IntegerHelper.getInt(data[0],data[1]); recalculateOnSave = (mode == 1); }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting records * @param si the sheet * @param ws the workbook settings * @param dummy dummy overload to indicate a biff 7 workbook */ public RStringRecord(Record t,FormattingRecords fr,SheetImpl si,WorkbookSettings ws,Biff7 dummy) : base(t,fr,si) { byte[] data = getRecord().getData(); length = IntegerHelper.getInt(data[6],data[7]); description = StringHelper.getString(data,length,8,ws); }
/** * Constructs this object from the raw data * * @param t the raw data */ public ProtectRecord(Record t) : base(t) { byte[] data = getRecord().getData(); int protflag = IntegerHelper.getInt(data[0],data[1]); prot = (protflag == 1); }
/** * Constructs the dimensions from the raw data * * @param t the raw data */ public PaneRecord(Record t) : base(t) { byte[] data = t.getData(); columnsVisible = IntegerHelper.getInt(data[0],data[1]); rowsVisible = IntegerHelper.getInt(data[2],data[3]); }
/** * Constructs this record from the raw data * @param r the record */ public SCLRecord(Record r) : base(Type.SCL) { byte[] data = r.getData(); numerator = IntegerHelper.getInt(data[0],data[1]); denominator = IntegerHelper.getInt(data[2],data[3]); }
/** * Constructs the dimensions from the raw data * * @param t the raw data */ public CountryRecord(Record t) : base(t) { byte[] data = t.getData(); language = IntegerHelper.getInt(data[0],data[1]); regionalSettings = IntegerHelper.getInt(data[2],data[3]); }
/** * Constructs this object from the raw data * * @param t the raw data */ public NoteRecord(Record t) : base(t) { data = getRecord().getData(); row = IntegerHelper.getInt(data[0],data[1]); column = IntegerHelper.getInt(data[2],data[3]); objectId = (uint)IntegerHelper.getInt(data[6],data[7]); }
/** * Constructs this object from the raw data * * @param r the raw data */ public GuttersRecord(Record r) : base(r) { byte[] data = getRecord().getData(); width = IntegerHelper.getInt(data[0],data[1]); height = IntegerHelper.getInt(data[2],data[3]); rowOutlineLevel = IntegerHelper.getInt(data[4],data[5]); columnOutlineLevel = IntegerHelper.getInt(data[6],data[7]); }
/** * Constructs the def col width from the raw data * * @param t the raw data */ public DefaultRowHeightRecord(Record t) : base(t) { byte[] data = t.getData(); if (data.Length > 2) { height = IntegerHelper.getInt(data[2],data[3]); } }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting records * @param si the sheet * @param ws the workbook settings */ public LabelRecord(Record t,FormattingRecords fr,SheetImpl si,WorkbookSettings ws) : base(t,fr,si) { byte[] data = getRecord().getData(); length = IntegerHelper.getInt(data[6],data[7]); if (data[8] == 0x0) description = StringHelper.getString(data,length,9,ws); else description = StringHelper.getUnicodeString(data,length,9); }
/** * Constructor */ public DataValiditySettingsRecord(Record t, ExternalSheet es, WorkbookMethods wm, WorkbookSettings ws) : base(t) { data = t.getData(); externalSheet = es; workbook = wm; workbookSettings = ws; }
/** * Constructs this number * * @param t the data * @param excelFile the excel biff data * @param v the value * @param fr the formatting records * @param es the external sheet * @param nt the name table * @param si the sheet */ public SharedBooleanFormulaRecord(Record t, File excelFile, bool v, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si) : base(t,fr,es,nt,si,excelFile.getPos()) { value = v; }
/** * Constructs this number * * @param t the data * @param excelFile the excel biff data * @param v the errorCode * @param fr the formatting records * @param es the external sheet * @param nt the name table * @param si the sheet */ public SharedErrorFormulaRecord(Record t, File excelFile, int ec, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si) : base(t,fr,es,nt,si,excelFile.getPos()) { errorCode = ec; }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the available formats * @param si the sheet */ public NumberRecord(Record t,FormattingRecords fr,SheetImpl si) : base(t,fr,si) { byte[] data = getRecord().getData(); value = DoubleHelper.getIEEEDouble(data,6); // Now get the number format format = fr.getNumberFormat(getXFIndex()); if (format == null) format = defaultFormat; }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting records * @param es the external sheet * @param nt the name table * @param si the sheet */ public ErrorFormulaRecord(Record t,FormattingRecords fr,ExternalSheet es, WorkbookMethods nt,SheetImpl si) : base(t,fr,si) { externalSheet = es; nameTable = nt; data = getRecord().getData(); Assert.verify(data[6] == 2); errorCode = data[8]; }
/** * Constructs the dimensions from the raw data * * @param t the raw data * @param biff7 an indicator to initialise this record for biff 7 format */ public HorizontalPageBreaksRecord(Record t,Biff7 biff7) : base(t) { byte[] data = t.getData(); int numbreaks = IntegerHelper.getInt(data[0],data[1]); int pos = 2; rowBreaks = new int[numbreaks]; for (int i = 0; i < numbreaks; i++) { rowBreaks[i] = IntegerHelper.getInt(data[pos],data[pos + 1]); pos += 2; } }
/** * Constructs this number * * @param t the data * @param excelFile the excel biff data * @param v the value * @param fr the formatting records * @param es the external sheet * @param nt the name table * @param si the sheet */ public SharedNumberFormulaRecord(Record t, File excelFile, double v, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si) : base(t,fr,es,nt,si,excelFile.getPos()) { value = v; format = defaultFormat; // format is set up later from the // SharedFormulaRecord }
/** * Constructs the blank records from the raw data * * @param t the raw data */ public MulBlankRecord(Record t) : base(t) { byte[] data = getRecord().getData(); int length = getRecord().getLength(); row = IntegerHelper.getInt(data[0],data[1]); colFirst = IntegerHelper.getInt(data[2],data[3]); colLast = IntegerHelper.getInt(data[length - 2],data[length - 1]); numblanks = colLast - colFirst + 1; xfIndices = new int[numblanks]; readBlanks(data); }
/** * Constructor which creates this object from the binary data * * @param t the record */ public SetupRecord(Record t) : base(Type.SETUP) { data = t.getData(); paperSize = IntegerHelper.getInt(data[0], data[1]); scaleFactor = IntegerHelper.getInt(data[2], data[3]); pageStart = IntegerHelper.getInt(data[4], data[5]); fitWidth = IntegerHelper.getInt(data[6], data[7]); fitHeight = IntegerHelper.getInt(data[8], data[9]); horizontalPrintResolution = IntegerHelper.getInt(data[12], data[13]); verticalPrintResolution = IntegerHelper.getInt(data[14], data[15]); copies = IntegerHelper.getInt(data[32], data[33]); headerMargin = DoubleHelper.getIEEEDouble(data, 16); footerMargin = DoubleHelper.getIEEEDouble(data, 24); int grbit = IntegerHelper.getInt(data[10], data[11]); pageOrder = ((grbit & 0x01) != 0); portraitOrientation = ((grbit & 0x02) != 0); initialized = ((grbit & 0x04) == 0); }
/** * Constructs this object from the raw data * * @param t the record data * @param ws the workbook settings */ public FooterRecord(Record t, WorkbookSettings ws) : base(t) { byte[] data = getRecord().getData(); if (data.Length == 0) { return; } int chars = IntegerHelper.getInt(data[0], data[1]); bool unicode = data[2] == 1; if (unicode) { footer = StringHelper.getUnicodeString(data, chars, 3); } else { footer = StringHelper.getString(data, chars, 3, ws); } }
/** * 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); }
/** * Constructor * * @param r the record */ public TopMarginRecord(Record r) : base(Type.TOPMARGIN, r) { }