It really depends on the damage to the rim. If the metal in the rim is crimped, cracked, or stretched, then the rim needs to be replaced. If the bends are more gradual curves then you probably can fix it, but you will most likely need to remove all of the spokes before re-shaping the rim.
Al