def prepare_defined_names #:nodoc:
      @worksheets.each do |sheet|
        # Check for Print Area settings.
        if sheet.autofilter_area
          @defined_names << [
                             '_xlnm._FilterDatabase',
                             sheet.index,
                             sheet.autofilter_area,
                             1
                            ]
        end

        # Check for Print Area settings.
        if !sheet.print_area.empty?
          @defined_names << [
                             '_xlnm.Print_Area',
                             sheet.index,
                             sheet.print_area
                            ]
        end

        # Check for repeat rows/cols. aka, Print Titles.
        if !sheet.print_repeat_cols.empty? || !sheet.print_repeat_rows.empty?
          if !sheet.print_repeat_cols.empty? && !sheet.print_repeat_rows.empty?
            range = sheet.print_repeat_cols + ',' + sheet.print_repeat_rows
          else
            range = sheet.print_repeat_cols + sheet.print_repeat_rows
          end

          # Store the defined names.
          @defined_names << ['_xlnm.Print_Titles', sheet.index, range]
        end
      end

      @defined_names  = sort_defined_names(@defined_names)
      @named_ranges  = extract_named_ranges(@defined_names)
    end
def prepare_defined_names #:nodoc:
      @worksheets.each do |sheet|
        # Check for Print Area settings.
        if sheet.autofilter_area
          @defined_names << [
                             '_xlnm._FilterDatabase',
                             sheet.index,
                             sheet.autofilter_area,
                             1
                            ]
        end

        # Check for Print Area settings.
        if !sheet.print_area.empty?
          @defined_names << [
                             '_xlnm.Print_Area',
                             sheet.index,
                             sheet.print_area
                            ]
        end

        # Check for repeat rows/cols. aka, Print Titles.
        if !sheet.print_repeat_cols.empty? || !sheet.print_repeat_rows.empty?
          if !sheet.print_repeat_cols.empty? && !sheet.print_repeat_rows.empty?
            range = sheet.print_repeat_cols + ',' + sheet.print_repeat_rows
          else
            range = sheet.print_repeat_cols + sheet.print_repeat_rows
          end

          # Store the defined names.
          @defined_names << ['_xlnm.Print_Titles', sheet.index, range]
        end
      end

      @defined_names  = sort_defined_names(@defined_names)
      @named_ranges  = extract_named_ranges(@defined_names)
    end
Iterate through the worksheets and store any defined names in addition to
 any user defined names. Stores the defined names for the Workbook.xml and
 the named ranges for App.xml.