patch for 'formula' method, which was excluding the first letter of the formula

1 view
Skip to first unread message

drhuffman12

unread,
Dec 19, 2010, 4:13:37 AM12/19/10
to ruby-roo
# require ...

class Openoffice < GenericSpreadsheet

# skipping unaltered code before here ... now for the method we are
updating:

# Returns the formula at (row,col).
# Returns nil if there is no formula.
# The method #formula? checks if there is a formula.
def formula(row,col,sheet=nil)
sheet = @default_sheet unless sheet
read_cells(sheet) unless @cells_read[sheet]
row,col = normalize(row,col)
if @formula[sheet][[row,col]] == nil
return nil
else
# return @formula[sheet][[row,col]]["oooc:".length..-1] #
Original line; this chops off the first letter of the formula name
(e.g.: "SUM" becomes "UM")
return @formula[sheet][[row,col]][("oooc:".length-1)..-1] # New
line; this includes the first letter of the formula name.
end
end

# ... method updated, continue w/ remaining code after here.

end
Reply all
Reply to author
Forward
0 new messages