public override Object Clone() { BlankRecord rec = new BlankRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; rec.field_3_xf = field_3_xf; return(rec); }
/** * Converts a {@link MulBlankRecord} into an equivalent array of {@link BlankRecord}s */ public static BlankRecord[] ConvertBlankRecords(MulBlankRecord mbk) { BlankRecord[] mulRecs = new BlankRecord[mbk.NumColumns]; for (int k = 0; k < mbk.NumColumns; k++) { BlankRecord br = new BlankRecord(); br.Column = k + mbk.FirstColumn; br.Row = mbk.Row; br.XFIndex = mbk.GetXFAt(k); mulRecs[k] = br; } return(mulRecs); }
private IList TestData() { IList records = new ArrayList(); FormulaRecord formulaRecord = new FormulaRecord(); //UnknownRecord unknownRecord = new UnknownRecord(); BlankRecord blankRecord = new BlankRecord(); WindowOneRecord windowOneRecord = new WindowOneRecord(); formulaRecord.Row = 1; formulaRecord.Column = 1; blankRecord.Row = 2; blankRecord.Column = 2; records.Add(formulaRecord); records.Add(blankRecord); records.Add(windowOneRecord); return records; }
public void AddMultipleBlanks(MulBlankRecord mbr) { for (int j = 0; j < mbr.NumColumns; j++) { BlankRecord br = new BlankRecord(); br.Column = j + mbr.FirstColumn; br.Row = mbr.Row; br.XFIndex = (mbr.GetXFAt(j)); InsertCell(br); } }
public void TestLastAndFirstColumns_bug46654() { int ROW_IX = 10; int COL_IX = 3; HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("Sheet1"); RowRecord rowRec = new RowRecord(ROW_IX); rowRec.FirstCol=((short)2); rowRec.LastCol=((short)5); BlankRecord br = new BlankRecord(); br.Row=(ROW_IX); br.Column=((short)COL_IX); sheet.Sheet.AddValueRecord(ROW_IX, br); HSSFRow row = new HSSFRow(workbook,sheet, rowRec); ICell cell = row.CreateCellFromRecord(br); if (row.FirstCellNum == 2 && row.LastCellNum == 5) { throw new AssertionException("Identified bug 46654a"); } Assert.AreEqual(COL_IX, row.FirstCellNum); Assert.AreEqual(COL_IX + 1, row.LastCellNum); row.RemoveCell(cell); Assert.AreEqual(-1, row.FirstCellNum); Assert.AreEqual(-1, row.LastCellNum); }
public void TestSheetDimensions() { InternalSheet sheet = InternalSheet.CreateSheet(); DimensionsRecord dimensions = (DimensionsRecord)sheet.FindFirstRecordBySid(DimensionsRecord.sid); Assert.AreEqual(0, dimensions.FirstCol); Assert.AreEqual(0, dimensions.FirstRow); Assert.AreEqual(1, dimensions.LastCol); // plus pne Assert.AreEqual(1, dimensions.LastRow); // plus pne RowRecord rr = new RowRecord(0); sheet.AddRow(rr); Assert.AreEqual(0, dimensions.FirstCol); Assert.AreEqual(0, dimensions.FirstRow); Assert.AreEqual(1, dimensions.LastCol); Assert.AreEqual(1, dimensions.LastRow); CellValueRecordInterface cvr; cvr = new BlankRecord(); cvr.Column = ((short)0); cvr.Row = (0); sheet.AddValueRecord(0, cvr); Assert.AreEqual(0, dimensions.FirstCol); Assert.AreEqual(0, dimensions.FirstRow); Assert.AreEqual(1, dimensions.LastCol); Assert.AreEqual(1, dimensions.LastRow); cvr = new BlankRecord(); cvr.Column = ((short)1); cvr.Row = (0); sheet.AddValueRecord(0, cvr); Assert.AreEqual(0, dimensions.FirstCol); Assert.AreEqual(0, dimensions.FirstRow); Assert.AreEqual(2, dimensions.LastCol); //YK: failed until Bugzilla 53414 was fixed Assert.AreEqual(1, dimensions.LastRow); }
public void TestRowValueAggregatesOrder_bug45145() { InternalSheet sheet = InternalSheet.CreateSheet(); RowRecord rr = new RowRecord(5); sheet.AddRow(rr); CellValueRecordInterface cvr = new BlankRecord(); cvr.Column = 0; cvr.Row = (5); sheet.AddValueRecord(5, cvr); int dbCellRecordPos = GetDbCellRecordPos(sheet); if (dbCellRecordPos == 252) { // The overt symptom of the bug // DBCELL record pos is1 calculated wrong if VRA comes before RRA throw new AssertionException("Identified bug 45145"); } Assert.AreEqual(242, dbCellRecordPos); }
/// <summary> /// Sets the cell type. The SetValue flag indicates whether to bother about /// trying to preserve the current value in the new record if one is Created. /// The SetCellValue method will call this method with false in SetValue /// since it will overWrite the cell value later /// </summary> /// <param name="cellType">Type of the cell.</param> /// <param name="setValue">if set to <c>true</c> [set value].</param> /// <param name="row">The row.</param> /// <param name="col">The col.</param> /// <param name="styleIndex">Index of the style.</param> private void SetCellType(CellType cellType, bool setValue, int row, int col, short styleIndex) { if (cellType > CellType.ERROR) { throw new Exception("I have no idea what type that Is!"); } switch (cellType) { case CellType.FORMULA: FormulaRecordAggregate frec = null; if (cellType != this.cellType) { frec = sheet.Sheet.RowsAggregate.CreateFormula(row, col); } else { frec = (FormulaRecordAggregate)record; } frec.Column = col; if (setValue) { frec.FormulaRecord.Value = NumericCellValue; } frec.XFIndex = styleIndex; frec.Row = row; record = frec; break; case CellType.NUMERIC: NumberRecord nrec = null; if (cellType != this.cellType) { nrec = new NumberRecord(); } else { nrec = (NumberRecord)record; } nrec.Column = col; if (setValue) { nrec.Value = NumericCellValue; } nrec.XFIndex = styleIndex; nrec.Row = row; record = nrec; break; case CellType.STRING: LabelSSTRecord lrec = null; if (cellType != this.cellType) { lrec = new LabelSSTRecord(); } else { lrec = (LabelSSTRecord)record; } lrec.Column = col; lrec.Row = row; lrec.XFIndex = styleIndex; if (setValue) { String str = ConvertCellValueToString(); int sstIndex = book.Workbook.AddSSTString(new UnicodeString(str)); lrec.SSTIndex = (sstIndex); UnicodeString us = book.Workbook.GetSSTString(sstIndex); stringValue = new HSSFRichTextString(); stringValue.UnicodeString = us; } record = lrec; break; case CellType.BLANK: BlankRecord brec = null; if (cellType != this.cellType) { brec = new BlankRecord(); } else { brec = (BlankRecord)record; } brec.Column = col; // During construction the cellStyle may be null for a Blank cell. brec.XFIndex = styleIndex; brec.Row = row; record = brec; break; case CellType.BOOLEAN: BoolErrRecord boolRec = null; if (cellType != this.cellType) { boolRec = new BoolErrRecord(); } else { boolRec = (BoolErrRecord)record; } boolRec.Column = col; if (setValue) { boolRec.SetValue(ConvertCellValueToBoolean()); } boolRec.XFIndex = styleIndex; boolRec.Row = row; record = boolRec; break; case CellType.ERROR: BoolErrRecord errRec = null; if (cellType != this.cellType) { errRec = new BoolErrRecord(); } else { errRec = (BoolErrRecord)record; } errRec.Column = col; if (setValue) { errRec.SetValue((byte)HSSFErrorConstants.ERROR_VALUE); } errRec.XFIndex = styleIndex; errRec.Row = row; record = errRec; break; } if (cellType != this.cellType && this.cellType != CellType.Unknown) // Special Value to indicate an Uninitialized Cell { sheet.Sheet.ReplaceValueRecord(record); } this.cellType = cellType; }
private BlankRecord NewBlankRecord(int col, int row) { BlankRecord blankRecord = new BlankRecord(); blankRecord.Row = (row); blankRecord.Column = ((short)col); return blankRecord; }
/// <summary> /// Create a BLANK record (does not Add it to the records contained in this sheet) /// </summary> /// <param name="row">the row the BlankRecord is a member of</param> /// <param name="col">the column the BlankRecord is a member of</param> /// <returns></returns> public BlankRecord CreateBlank(int row, short col) { //log.LogFormatted(POILogger.DEBUG, "Create blank row,col %,%", new int[] //{ // row, col //}); BlankRecord rec = new BlankRecord(); rec.Row = row; rec.Column = col; rec.XFIndex = (short)0x0f; return rec; }
public override Object Clone() { BlankRecord rec = new BlankRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; rec.field_3_xf = field_3_xf; return rec; }
/** * Converts a {@link MulBlankRecord} into an equivalent array of {@link BlankRecord}s */ public static BlankRecord[] ConvertBlankRecords(MulBlankRecord mbk) { BlankRecord[] mulRecs = new BlankRecord[mbk.NumColumns]; for (int k = 0; k < mbk.NumColumns; k++) { BlankRecord br = new BlankRecord(); br.Column = k + mbk.FirstColumn; br.Row = mbk.Row; br.XFIndex = mbk.GetXFAt(k); mulRecs[k] = br; } return mulRecs; }