def set_row(row, height = nil, format = nil, hidden = false, level = 0, collapsed = false)
    record      = 0x0208               # Record identifier
    length      = 0x0010               # Number of bytes to follow

    colMic      = 0x0000               # First defined column
    colMac      = 0x0000               # Last defined column
    # miyRw;                           # Row height
    irwMac      = 0x0000               # Used by Excel to optimise loading
    reserved    = 0x0000               # Reserved
    grbit       = 0x0000               # Option flags
    # ixfe;                            # XF index

    return unless row

    # Check that row and col are valid and store max and min values
    return -2 if check_dimensions(row, 0, 0, 1) != 0

    # Check for a format object
    if format.respond_to?(:xf_index)
      ixfe = format.xf_index
    else
      ixfe = 0x0F
    end

    # Set the row height in units of 1/20 of a point. Note, some heights may
    # not be obtained exactly due to rounding in Excel.
    #
    if height
      miyRw = height *20
    else
      miyRw = 0xff # The default row height
      height = 0
    end

    # Set the limits for the outline levels (0 <= x <= 7).
    level = 0 if level < 0
    level = 7 if level > 7

    @outline.row_level = level if level > @outline.row_level

    # Set the options flags.
    # 0x10: The fCollapsed flag indicates that the row contains the "+"
    #       when an outline group is collapsed.
    # 0x20: The fDyZero height flag indicates a collapsed or hidden row.
    # 0x40: The fUnsynced flag is used to show that the font and row heights
    #       are not compatible. This is usually the case for WriteExcel.
    # 0x80: The fGhostDirty flag indicates that the row has been formatted.
    #
    grbit |= level
    grbit |= 0x0010 if collapsed && collapsed != 0
    grbit |= 0x0020 if hidden && hidden != 0
    grbit |= 0x0040
    grbit |= 0x0080 if format
    grbit |= 0x0100

    header = [record, length].pack("vv")
    data   = [row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe].pack("vvvvvvvv")

    # Store the data or write immediately depending on the compatibility mode.
    if compatibility?
      @row_data[row] = header + data
    else
      append(header, data)
    end

    # Store the row sizes for use when calculating image vertices.
    # Also store the column formats.
    @row_sizes[row]   = height
    @row_formats[row] = format if format
  end
def set_row(row, height = nil, format = nil, hidden = false, level = 0, collapsed = false)
    record      = 0x0208               # Record identifier
    length      = 0x0010               # Number of bytes to follow

    colMic      = 0x0000               # First defined column
    colMac      = 0x0000               # Last defined column
    # miyRw;                           # Row height
    irwMac      = 0x0000               # Used by Excel to optimise loading
    reserved    = 0x0000               # Reserved
    grbit       = 0x0000               # Option flags
    # ixfe;                            # XF index

    return unless row

    # Check that row and col are valid and store max and min values
    return -2 if check_dimensions(row, 0, 0, 1) != 0

    # Check for a format object
    if format.respond_to?(:xf_index)
      ixfe = format.xf_index
    else
      ixfe = 0x0F
    end

    # Set the row height in units of 1/20 of a point. Note, some heights may
    # not be obtained exactly due to rounding in Excel.
    #
    if height
      miyRw = height *20
    else
      miyRw = 0xff # The default row height
      height = 0
    end

    # Set the limits for the outline levels (0 <= x <= 7).
    level = 0 if level < 0
    level = 7 if level > 7

    @outline.row_level = level if level > @outline.row_level

    # Set the options flags.
    # 0x10: The fCollapsed flag indicates that the row contains the "+"
    #       when an outline group is collapsed.
    # 0x20: The fDyZero height flag indicates a collapsed or hidden row.
    # 0x40: The fUnsynced flag is used to show that the font and row heights
    #       are not compatible. This is usually the case for WriteExcel.
    # 0x80: The fGhostDirty flag indicates that the row has been formatted.
    #
    grbit |= level
    grbit |= 0x0010 if collapsed && collapsed != 0
    grbit |= 0x0020 if hidden && hidden != 0
    grbit |= 0x0040
    grbit |= 0x0080 if format
    grbit |= 0x0100

    header = [record, length].pack("vv")
    data   = [row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe].pack("vvvvvvvv")

    # Store the data or write immediately depending on the compatibility mode.
    if compatibility?
      @row_data[row] = header + data
    else
      append(header, data)
    end

    # Store the row sizes for use when calculating image vertices.
    # Also store the column formats.
    @row_sizes[row]   = height
    @row_formats[row] = format if format
  end
row       : Row Number
          height    : Format object
          format    : Format object
          hidden    : Hidden boolean flag
          level     : Outline level
          collapsed : Collapsed row

 This method is used to set the height and XF format for a row.
 Writes the  BIFF record ROW.

 This method can be used to change the default properties of a row. All
 parameters apart from _row_ are optional.

 The most common use for this method is to change the height of a row:

     worksheet.set_row(0, 20) # Row 1 height set to 20

 If you wish to set the _format_ without changing the _height_ you can pass
 nil as the _height_ parameter:

     worksheet.set_row(0, nil, format)

 The _format_ parameter will be applied to any cells in the row that don't
 have a format. For example

     worksheet.set_row(0, nil, format1)      # Set the format for row 1
     worksheet.write('A1', 'Hello')          # Defaults to format1
     worksheet.write('B1', 'Hello', format2) # Keeps format2

 If you wish to define a row format in this way you should call the method
 before any calls to write(). Calling it afterwards will overwrite any format
 that was previously specified.

 The hidden parameter should be set to true if you wish to hide a row. This can
 be used, for example, to hide intermediary steps in a complicated calculation:

     worksheet.set_row(0, 20,  format, true)
     worksheet.set_row(1, nil, nil,    true)

 The level parameter is used to set the outline level of the row. Outlines
 are described in "OUTLINES AND GROUPING IN EXCEL". Adjacent rows with the
 same outline level are grouped together into a single outline.

 The following example sets an outline level of 1 for rows 1 and 2
 (zero-indexed):

     worksheet.set_row(1, nil, nil, false, 1)
     worksheet.set_row(2, nil, nil, false, 1)

 The hidden parameter can also be used to hide collapsed outlined rows when
 used in conjunction with the level parameter.

     worksheet.set_row(1, nil, nil, true, 1)
     worksheet.set_row(2, nil, nil, true, 1)

 For collapsed outlines you should also indicate which row has the
 collapsed + symbol using the optional collapsed parameter.

     worksheet.set_row(3, nil, nil, false, 0, true)

 For a more complete example see the outline.pl and outline_collapsed.rb
 programs in the examples directory of the distro.

 Excel allows up to 7 outline levels. Therefore the level parameter should
 be in the range 0 <= level <= 7.