lib/writeexcel/workbook.rb in writeexcel-0.6.5 vs lib/writeexcel/workbook.rb in writeexcel-0.6.6
- old
+ new
@@ -28,17 +28,10 @@
BOF = 12 # :nodoc:
EOF = 4 # :nodoc:
SheetName = "Sheet" # :nodoc:
- private
-
- attr_accessor :add_doc_properties #:nodoc:
- attr_reader :formats, :defined_names #:nodoc:
-
- public
-
#
# _file_ is a filename (as string) or io object where to out spreadsheet data.
# you can set default format of workbook using _default_formats_.
#
# A new Excel workbook is created using the new() constructor which accepts
@@ -725,18 +718,18 @@
blue = $3.hex
end
# Check that the colour index is the right range
if index < 8 || index > 64
- raise "Color index #{index} outside range: 8 <= index <= 64";
+ raise "Color index #{index} outside range: 8 <= index <= 64"
end
# Check that the colour components are in the right range
if (red < 0 || red > 255) ||
(green < 0 || green > 255) ||
(blue < 0 || blue > 255)
- raise "Color component outside range: 0 <= color <= 255";
+ raise "Color component outside range: 0 <= color <= 255"
end
index -=8 # Adjust colour index (wingless dragonfly)
# Set the RGB value
@@ -914,11 +907,11 @@
sheet_index = 0
full_name = name.downcase
if name =~ /^(.*)!(.*)$/
sheetname = $1
- name = $2;
+ name = $2
sheet_index = 1 + @parser.get_sheet_index(sheetname)
end
# Strip the = sign at the beginning of the formula string
formula = formula.sub(/^=/, '')
@@ -982,13 +975,13 @@
#
# User defined properties are not supported due to effort required.
#
# You can also pass UTF-8 strings as properties.
#
- # $workbook->set_properties(
- # :subject => "住所録",
- # );
+ # workbook.set_properties(
+ # :subject => "住所録"
+ # )
#
# Usually WriteExcel allows you to use UTF-16. However, document properties
# don't support UTF-16 for these type of strings.
#
# In order to promote the usefulness of Ruby and the WriteExcel module
@@ -1085,11 +1078,11 @@
private :valid_properties
def check_valid_params_for_properties(params) #:nodoc:
params.each_key do |k|
unless valid_properties.has_key?(k)
- raise "Unknown parameter '#{k}' in set_properties()";
+ raise "Unknown parameter '#{k}' in set_properties()"
end
end
end
private :check_valid_params_for_properties
@@ -1106,11 +1099,11 @@
return 0xFDE9 unless params[:utf8].nil?
properties.each do |property|
next unless params.has_key?(property.to_sym)
return 0xFDE9 if is_utf8?(params[property.to_sym])
end
- return 0x04E4; # Default codepage, Latin 1.
+ return 0x04E4 # Default codepage, Latin 1.
end
private :get_property_set_codepage
###############################################################################
#
@@ -1424,12 +1417,12 @@
#
def process_images #:nodoc:
images_seen = {}
image_data = []
previous_images = []
- image_id = 1;
- images_size = 0;
+ image_id = 1
+ images_size = 0
@worksheets.each do |sheet|
next unless sheet.sheet_type == 0x0000
next if sheet.prepare_images == 0
@@ -1508,12 +1501,12 @@
# Store information required by the Workbook.
image_data.push([ref_count, type, data, size,
checksum1, checksum2])
# Keep track of overall data size.
- images_size += size +61; # Size for bstore container.
- image_mso_size += size +69; # Size for dgg container.
+ images_size += size +61 # Size for bstore container.
+ image_mso_size += size +69 # Size for dgg container.
images_seen[filename] = image_id
image_id += 1
fh.close
else
@@ -1640,11 +1633,11 @@
# Extract width and height information from a JPEG file.
#
def process_jpg(data, filename) # :nodoc:
type = 5 # Excel Blip type (MSOBLIPTYPE).
- offset = 2;
+ offset = 2
data_length = data.bytesize
# Search through the image data to find the 0xFFC0 marker. The height and
# width are contained in the data for that sub element.
while offset < data_length
@@ -3205,6 +3198,24 @@
def cleanup #:nodoc:
super
sheets.each { |sheet| sheet.cleanup }
end
private :cleanup
+
+ private
+
+ def add_doc_properties
+ @add_doc_properties
+ end
+
+ def add_doc_properties=(val)
+ @add_doc_properties = val
+ end
+
+ def formats
+ @formats
+ end
+
+ def defined_names
+ @defined_names
+ end
end