def set_rotation(rotation)
    # The arg type can be a double but the Excel dialog only allows integers.
    rotation = rotation.to_i

    #      if (rotation == 270)
    #         rotation = 255
    #      elsif (rotation >= -90 or rotation <= 90)
    #         rotation = -rotation +90 if rotation < 0;
    #      else
    #         # carp "Rotation $rotation outside range: -90 <= angle <= 90";
    #         rotation = 0;
    #      end
    #
    if rotation == 270
      rotation = 255
    elsif rotation >= -90 && rotation <= 90
      rotation = -rotation + 90 if rotation < 0
    else
      rotation = 0
    end

    @rotation = rotation
  end
def set_rotation(rotation)
    # The arg type can be a double but the Excel dialog only allows integers.
    rotation = rotation.to_i

    #      if (rotation == 270)
    #         rotation = 255
    #      elsif (rotation >= -90 or rotation <= 90)
    #         rotation = -rotation +90 if rotation < 0;
    #      else
    #         # carp "Rotation $rotation outside range: -90 <= angle <= 90";
    #         rotation = 0;
    #      end
    #
    if rotation == 270
      rotation = 255
    elsif rotation >= -90 && rotation <= 90
      rotation = -rotation + 90 if rotation < 0
    else
      rotation = 0
    end

    @rotation = rotation
  end
Set the rotation angle of the text. An alignment property.

     Default state:      Text rotation is off
     Default action:     None
     Valid args:         Integers in the range -90 to 90 and 270

 Set the rotation of the text in a cell. The rotation can be any angle in
 the range -90 to 90 degrees.

     format = workbook.add_format
     format.set_rotation(30)
     worksheet.write(0, 0, 'This text is rotated', format)

 The angle 270 is also supported. This indicates text where the letters run
 from top to bottom.