/** * Constructs this record from the raw data * * @param t the type * @param r the record */ public MarginRecord(Type t, Record r) : base(t) { byte[] data = r.getData(); margin = DoubleHelper.getIEEEDouble(data, 0); }
/// <summary> Constructs this object from the raw data. Creates either a /// NumberFormulaRecord or a StringFormulaRecord depending on whether /// this formula represents a numerical calculation or not /// /// </summary> /// <param name="t">the raw data /// </param> /// <param name="excelFile">the excel file /// </param> /// <param name="fr">the formatting records /// </param> /// <param name="es">the workbook, which contains the external sheet references /// </param> /// <param name="nt">the name table /// </param> /// <param name="si">the sheet /// </param> /// <param name="ws">the workbook settings /// </param> public FormulaRecord(Record t, File excelFile, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si, WorkbookSettings ws) : base(t, fr, si) { sbyte[] data = getRecord().Data; shared = false; // Check to see if this forms part of a shared formula int grbit = IntegerHelper.getInt(data[14], data[15]); if ((grbit & 0x08) != 0) { shared = true; if (data[6] == 0 && data[12] == -1 && data[13] == -1) { // It is a shared string formula formula = new SharedStringFormulaRecord(t, excelFile, fr, es, nt, si, ws); } else { // It is a numerical formula double Value = DoubleHelper.getIEEEDouble(data, 6); formula = new SharedNumberFormulaRecord(t, excelFile, Value, fr, es, nt, si); } return; } // microsoft and their goddam magic values determine whether this // is a string or a number value if (data[6] == 0 && data[12] == -1 && data[13] == -1) { // we have a string formula = new StringFormulaRecord(t, excelFile, fr, es, nt, si, ws); } else if (data[6] == 1 && data[12] == -1 && data[13] == -1) { // We have a boolean formula // multiple values. Thanks to Frank for spotting this formula = new BooleanFormulaRecord(t, fr, es, nt, si); } else if (data[6] == 2 && data[12] == -1 && data[13] == -1) { // The cell is in error formula = new ErrorFormulaRecord(t, fr, es, nt, si); } else { // it is most assuredly a number formula = new NumberFormulaRecord(t, fr, es, nt, si); } }
/// <summary> Constructs this object from the raw data /// /// </summary> /// <param name="t">the raw data /// </param> /// <param name="fr">the available formats /// </param> /// <param name="si">the sheet /// </param> public NumberRecord(Record t, FormattingRecords fr, SheetImpl si) : base(t, fr, si) { sbyte[] data = getRecord().Data; _Value = DoubleHelper.getIEEEDouble(data, 6); // Now get the number format format = fr.getNumberFormat(XFIndex); if (format == null) { format = defaultFormat; } }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting record * @param es the external sheet * @param nt the name table * @param si the sheet */ public NumberFormulaRecord(Record t, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si) : base(t, fr, si) { externalSheet = es; nameTable = nt; data = getRecord().getData(); format = fr.getNumberFormat(getXFIndex()); if (format == null) { format = defaultFormat; } value = DoubleHelper.getIEEEDouble(data, 6); }
/// <summary> Constructor which creates this object from the binary data /// /// </summary> /// <param name="t">the record /// </param> internal SetupRecord(Record t) : base(NExcel.Biff.Type.SETUP) { data = t.Data; 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]); portraitOrientation = ((grbit & 0x02) != 0); }
/** * Constructs this object from the raw data. Creates either a * NumberFormulaRecord or a StringFormulaRecord depending on whether * this formula represents a numerical calculation or not * * @param t the raw data * @param excelFile the excel file * @param fr the formatting records * @param es the workbook, which contains the external sheet references * @param nt the name table * @param si the sheet * @param ws the workbook settings */ public FormulaRecord(Record t, File excelFile, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si, WorkbookSettings ws) : base(t, fr, si) { byte[] data = getRecord().getData(); shared = false; // Check to see if this forms part of a shared formula int grbit = IntegerHelper.getInt(data[14], data[15]); if ((grbit & 0x08) != 0) { shared = true; if (data[6] == 0 && data[12] == 0xff && data[13] == 0xff) { // It is a shared string formula formula = new SharedStringFormulaRecord(t, excelFile, fr, es, nt, si, ws); } else if (data[6] == 3 && data[12] == 0xff && data[13] == 0xff) { // We have a string which evaluates to null formula = new SharedStringFormulaRecord(t, excelFile, fr, es, nt, si, SharedStringFormulaRecord.EMPTY_STRING); } else if (data[6] == 2 && data[12] == 0xff && data[13] == 0xff) { // The cell is in error int errorCode = data[8]; formula = new SharedErrorFormulaRecord(t, excelFile, errorCode, fr, es, nt, si); } else if (data[6] == 1 && data[12] == 0xff && data[13] == 0xff) { bool value = data[8] == 1 ? true : false; formula = new SharedBooleanFormulaRecord (t, excelFile, value, fr, es, nt, si); } else { // It is a numerical formula double value = DoubleHelper.getIEEEDouble(data, 6); SharedNumberFormulaRecord snfr = new SharedNumberFormulaRecord (t, excelFile, value, fr, es, nt, si); snfr.setNumberFormat(fr.getNumberFormat(getXFIndex())); formula = snfr; } return; } // microsoft and their goddam magic values determine whether this // is a string or a number value if (data[6] == 0 && data[12] == 0xff && data[13] == 0xff) { // we have a string formula = new StringFormulaRecord(t, excelFile, fr, es, nt, si, ws); } else if (data[6] == 1 && data[12] == 0xff && data[13] == 0xff) { // We have a bool formula // multiple values. Thanks to Frank for spotting this formula = new BooleanFormulaRecord(t, fr, es, nt, si); } else if (data[6] == 2 && data[12] == 0xff && data[13] == 0xff) { // The cell is in error formula = new ErrorFormulaRecord(t, fr, es, nt, si); } else if (data[6] == 3 && data[12] == 0xff && data[13] == 0xff) { // we have a string which evaluates to null formula = new StringFormulaRecord(t, fr, es, nt, si); } else { // it is most assuredly a number formula = new NumberFormulaRecord(t, fr, es, nt, si); } }
/// <summary> Reads the ptg data from the array starting at the specified position /// /// </summary> /// <param name="data">the RPN array /// </param> /// <param name="pos">the current position in the array, excluding the ptg identifier /// </param> /// <returns> the number of bytes read /// </returns> public override int read(sbyte[] data, int pos) { Value = DoubleHelper.getIEEEDouble(data, pos); return(8); }
/// <summary> Constructs this record from the raw data /// /// </summary> /// <param name="t">the type /// </param> /// <param name="r">the record /// </param> protected internal MarginRecord(NExcel.Biff.Type t, Record r) : base(t) { sbyte[] data = r.Data; margin = DoubleHelper.getIEEEDouble(data, 0); }