lib/writeexcel/format.rb in writeexcel-0.6.6 vs lib/writeexcel/format.rb in writeexcel-0.6.7
- old
+ new
@@ -23,18 +23,16 @@
module Writeexcel
class Format < Colors
require 'writeexcel/helper'
- ###############################################################################
#
- # initialize(xf_index=0, properties = {})
+ # Constructor
+ #
# xf_index :
# properties : Hash of property => value
#
- # Constructor
- #
def initialize(xf_index = 0, properties = {}) # :nodoc:
@xf_index = xf_index
@type = 0
@font_index = 0
@@ -177,14 +175,11 @@
@diag_border = other.diag_border
@font_only = other.font_only
end
- ###############################################################################
#
- # get_xf($style)
- #
# Generate an Excel BIFF XF record.
#
def get_xf # :nodoc:
# Local Variable
@@ -333,14 +328,11 @@
border1, border2, border3, icv].pack("vvvvvvvVv")
header + data
end
- ###############################################################################
#
- # get_font()
- #
# Generate an Excel BIFF FONT record.
#
def get_font # :nodoc:
# my $record; # Record identifier
@@ -404,14 +396,11 @@
bCharSet, reserved, cch, encoding].pack('vvvvvCCCCCC')
header + data + rgch
end
- ###############################################################################
#
- # get_font_key()
- #
# Returns a unique hash key for a font. Used by Workbook->_store_all_fonts()
#
def get_font_key # :nodoc:
# The following elements are arranged to increase the probability of
# generating a unique key. Elements that hold a large range of numbers
@@ -420,14 +409,11 @@
key = "#{@font}#{@size}#{@font_script}#{@underline}#{@font_strikeout}#{@bold}#{@font_outline}"
key += "#{@font_family}#{@font_charset}#{@font_shadow}#{@color}#{@italic}#{@font_encoding}"
key.gsub(' ', '_') # Convert the key to a single word
end
- ###############################################################################
#
- # xf_index()
- #
# Returns the used by Worksheet->_XF()
#
def xf_index # :nodoc:
@xf_index
end
@@ -614,26 +600,20 @@
def font_only # :nodoc:
@font_only
end
- ###############################################################################
#
- # class method Format._get_color(colour)
- #
# used from Worksheet.rb
#
# this is cut & copy of get_color().
#
def self._get_color(color) # :nodoc:
Colors.new.get_color(color)
end
- ###############################################################################
#
- # set_type()
- #
# Set the XF object type as 0 = cell XF or 0xFFF5 = style XF.
#
def set_type(type = nil) # :nodoc:
if !type.nil? and type == 0
@@ -984,14 +964,11 @@
when 'vequal_space' then set_text_v_align(4) # ParseExcel
else nil
end
end
- ###############################################################################
#
- # set_valign()
- #
# Set vertical cell alignment. This is required by the set_format_properties()
# method to differentiate between the vertical and horizontal properties.
#
def set_valign(alignment) # :nodoc:
set_align(alignment)
@@ -1021,12 +998,9 @@
#
def set_center_across(arg = 1)
set_text_h_align(6)
end
- ###############################################################################
- #
- # set_merge()
#
# This was the way to implement a merge in Excel5. However it should have been
# called "center_across" and not "merge".
# This is now deprecated. Use set_center_across() or better merge_range().
#