lib/write_xlsx/worksheet.rb in write_xlsx-0.65.0 vs lib/write_xlsx/worksheet.rb in write_xlsx-0.65.1
- old
+ new
@@ -76,25 +76,25 @@
# The following methods are available for page set-up:
#
# * set_landscape
# * set_portrait
# * set_page_view
- # * set_paper
+ # * {paper=}[#method-i-paper-3D]
# * center_horizontally
# * center_vertically
- # * set_margins
+ # * {margins=}[#method-i-margin-3D]
# * set_header
# * set_footer
# * repeat_rows
# * repeat_columns
# * hide_gridlines
# * print_row_col_headers
# * print_area
# * print_across
# * fit_to_pages
- # * set_start_page
- # * set_print_scale
+ # * {start_page=}[#method-i-start_page-3D]
+ # * {print_scale=}[#method-i-print_scale-3D]
# * set_h_pagebreaks
# * set_v_pagebreaks
#
# A common requirement when working with WriteXLSX is to apply the same
# page set-up features to all of the worksheets in a workbook. To do this
@@ -513,11 +513,11 @@
#
# This method is not required very often. The default value is the first worksheet.
#
def set_first_sheet
@hidden = false
- @workbook.firstsheet = self
+ @workbook.firstsheet = @index
end
#
# Set the worksheet protection flags to prevent modification of worksheet
# objects.
@@ -1587,24 +1587,26 @@
@page_setup.across = false
end
end
#
- # Not implememt yet.
- #--
- # The set_start_page() method is used to set the number of the
+ # The start_page=() method is used to set the number of the
# starting page when the worksheet is printed out.
# The default value is 1.
#
# worksheet.set_start_page(2)
- #++
#
- def set_start_page(page_start)
- @page_start = page_start
+ def start_page=(page_start)
+ @page_setup.page_start = page_start
@custom_start = 1
end
+ def set_start_page(page_start)
+ put_deprecate_message("#{self}.set_start_page")
+ self::start_page = page_start
+ end
+
#
# :call-seq:
# write(row, column [ , token [ , format ] ])
#
# Excel makes a distinction between data types such as strings, numbers,
@@ -5820,11 +5822,11 @@
# Write the XML elements for the format string fragments.
fragments.each do |token|
if token.respond_to?(:xf_index)
# Write the font run.
writer.start_tag('r')
- token.write_font(writer, self)
+ token.write_font_rpr(writer, self)
else
# Write the string fragment part, with whitespace handling.
attributes = []
attributes << 'xml:space' << 'preserve' if token =~ /^\s/ || token =~ /\s$/
@@ -6053,15 +6055,15 @@
def position_object_emus(col_start, row_start, x1, y1, width, height, is_drawing = true) #:nodoc:
col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs =
position_object_pixels(col_start, row_start, x1, y1, width, height, is_drawing)
# Convert the pixel values to EMUs. See above.
- x1 *= 9_525
- y1 *= 9_525
- x2 *= 9_525
- y2 *= 9_525
- x_abs *= 9_525
- y_abs *= 9_525
+ x1 = (0.5 + 9_525 * x1).to_i
+ y1 = (0.5 + 9_525 * y1).to_i
+ x2 = (0.5 + 9_525 * x2).to_i
+ y2 = (0.5 + 9_525 * y2).to_i
+ x_abs = (0.5 + 9_525 * x_abs).to_i
+ y_abs = (0.5 + 9_525 * y_abs).to_i
[col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs]
end
#