public XmlWriter makeTagBlock(SpreadSheetCell sheetCell, XmlWriter xmlWriter) { //The main header for the cell block xmlWriter.WriteStartElement("SheetCell"); //Add in the cell attributes xmlWriter.WriteElementString("Color", sheetCell.getColor().ToString()); xmlWriter.WriteElementString("RowIndex", sheetCell.getRowIndex().ToString()); xmlWriter.WriteElementString("ColumnIndex", sheetCell.getColumnIndex().ToString()); xmlWriter.WriteElementString("Text", sheetCell.getText().ToString()); //The end to the block (aka "</SheetCell>" xmlWriter.WriteEndElement(); return xmlWriter; }
//Performs the undo action public SpreadSheetCell undoAction(SpreadSheetCell cell) { //We must check if there is something to undo if (undoStack.Count > 0) { //Pop the previous state off of the stack SpreadSheetCell RevertToThis = undoStack.Pop(); cell.editType = RevertToThis.editType; redoStack.Push(cell); cell = RevertToThis; if (cell.getColor() == 0) cell.setColor(-1); } return cell; }