Method: Rods#deleteCellAfter

Defined in:
lib/rods.rb

#deleteCellAfter(cell) ⇒ Object

Delets the cell to the right of the given cell

cell=mySheet.writeGetCell(4,7,"date","16.01.2011")
mySheet.deleteCellAfter(cell)



2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
# File 'lib/rods.rb', line 2776

def deleteCellAfter(cell)
  die("deleteCellAfter: cell #{cell} is not a REXML::Element") unless (cell.class.to_s == "REXML::Element")
  #--------------------------------------------------------
  # Entweder Wiederholungsattribut der aktuellen Zelle
  # dekrementieren oder ggf. Wiederholungsattribut der
  # Folgezelle dekrementieren oder selbige loeschen
  #--------------------------------------------------------
  repetitions=cell.attributes["table:number-columns-repeated"]
  if(repetitions && repetitions.to_i > 1)
    cell.attributes["table:number-columns-repeated"]=(repetitions.to_i-1).to_s
  else
    nextCell=cell.next_sibling
    die("deleteCellAfter: cell is already last cell in row") unless (nextCell)
    nextRepetitions=nextCell.attributes["table:number-columns-repeated"]
    if(nextRepetitions && nextRepetitions.to_i > 1)
      nextCell.attributes["table:number-columns-repeated"]=(nextRepetitions.to_i-1).to_s
    else
      row=cell.elements["ancestor::table:table-row"]
      unless (row)
        die("deleteCellAfter: internal error: Could not extract parent-row of cell #{cell}") 
      end
      row.elements.delete(nextCell)
    end
  end
end