Skip to content

Commit

Permalink
Improved some of the Rdoc formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Wyss authored and Hannes Wyss committed Oct 13, 2008
1 parent d2dbc41 commit 945cccf
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 65 deletions.
4 changes: 3 additions & 1 deletion GUIDE.txt
Expand Up @@ -50,7 +50,7 @@ To access the values stored in a Row, treat the Row like an Array.

row[0]

=> this will return a String, a Float, an Integer, a Formula or a Date or
-> this will return a String, a Float, an Integer, a Formula or a Date or
DateTime object - or nil if the cell is empty.

More information about the formatting of a cell can be found in the Format
Expand Down Expand Up @@ -125,6 +125,8 @@ Limitations:
* Although it is theoretically possible, it is not recommended to write the
resulting Document back to the same File/IO that it was read from.

And here's how it works:

book = Spreadsheet.open '/path/to/an/excel-file.xls'
sheet = book.worksheet 0
sheet.each do |row|
Expand Down
16 changes: 8 additions & 8 deletions README.txt
Expand Up @@ -2,7 +2,7 @@

http://spreadsheet.rubyforge.org

== DESCRIPTION
== Description

The Spreadsheet Library is designed to read and write Spreadsheet Documents.
As of version 0.6.0, only Microsoft Excel compatible spreadsheets are
Expand All @@ -16,13 +16,13 @@ Hannes Wyss. Spreadsheet can read, write and modify Spreadsheet Documents.
* Improved handling of String Encodings

== Roadmap
0.7.0: Improved Format support/Styles
0.7.1: Document Modification: Formats/Styles
0.8.0: Formula Support
0.8.1: Document Modification: Formulas
0.9.0: Write-Support: BIFF5
1.0.0: Ruby 1.9 Support
Remove backward compatibility code
0.7.0:: Improved Format support/Styles
0.7.1:: Document Modification: Formats/Styles
0.8.0:: Formula Support
0.8.1:: Document Modification: Formulas
0.9.0:: Write-Support: BIFF5
1.0.0:: Ruby 1.9 Support;
Remove backward compatibility code

== Dependencies

Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -4,6 +4,8 @@ require 'rubygems'
require 'hoe'
require './lib/spreadsheet.rb'

ENV['RDOCOPT'] = '-c utf8'

Hoe.new('spreadsheet', Spreadsheet::VERSION) do |p|
# p.rubyforge_name = 'spreadsheetx' # if different than lowercase project name
p.developer('Hannes Wyss', 'hannes.wyss@gmail.com')
Expand Down
12 changes: 6 additions & 6 deletions lib/parseexcel.rb
Expand Up @@ -17,11 +17,11 @@
#
# Contact Information:
#
# E-Mail: hannes.wyss@gmail.com
# P-Mail: ywesee GmbH
# Hannes Wyss
# Winterthurerstrasse 52
# 8006 Zürich
### Switzerland
# E-Mail: hannes.wyss@gmail.com
# P-Mail: ywesee GmbH
# Hannes Wyss
# Winterthurerstrasse 52
# 8006 Zürich
### Switzerland

require 'parseexcel/parseexcel'
7 changes: 4 additions & 3 deletions lib/parseexcel/parseexcel.rb
Expand Up @@ -8,10 +8,11 @@
will be removed in Spreadsheet version 1.0.0
EOS

##
# The ParseExcel module is provided as a drop-in replacement for the ParseExcel
# library. This code is deprecated and will be removed in Spreadsheet version 1.0.0
module Spreadsheet
##
# The ParseExcel module is provided as a drop-in replacement for the
# ParseExcel library. This code is deprecated and will be removed in
# Spreadsheet version 1.0.0
module ParseExcel
def ParseExcel.parse path
Spreadsheet.open path
Expand Down
12 changes: 6 additions & 6 deletions lib/spreadsheet.rb
Expand Up @@ -17,12 +17,12 @@
#
# Contact Information:
#
# E-Mail: hannes.wyss@gmail.com
# P-Mail: ywesee GmbH
# Hannes Wyss
# Winterthurerstrasse 52
# 8006 Zürich
### Switzerland
# E-Mail: hannes.wyss@gmail.com
# P-Mail: ywesee GmbH
# Hannes Wyss
# Winterthurerstrasse 52
# 8006 Zürich
### Switzerland

require 'spreadsheet/excel/workbook'
require 'spreadsheet/excel/reader'
Expand Down
13 changes: 9 additions & 4 deletions lib/spreadsheet/font.rb
Expand Up @@ -10,18 +10,23 @@ class Font
attr_accessor :name
##
# You can set the following boolean Font attributes
# * #italic
# * #strikeout
# * #outline
# * #shadow
boolean :italic, :strikeout, :outline, :shadow
##
# Font color
colors :color
##
# Font weight
# Valid values: :normal, :bold or any positive Integer.
# In Excel: 100 <= weight <= 1000
# :bold => 700
# :normal => 400
# In Excel:
# 100 <= weight <= 1000
# :bold => 700
# :normal => 400
# Default: :normal
enum :weight, :normal, :bold, Integer, :bold => :b
enum :weight, :normal, :bold, Integer, :bold => :b
##
# Escapement
# Valid values: :normal, :superscript or :subscript.
Expand Down
31 changes: 16 additions & 15 deletions lib/spreadsheet/format.rb
Expand Up @@ -3,30 +3,30 @@
require 'spreadsheet/font'

module Spreadsheet
class FormatError < StandardError; end
##
# Formatting data
class Format
include Encodings
include Datatypes
##
# You can set the following boolean attributes:
# * cross_down: Draws a Line from the top-left to the bottom-right
# #cross_down:: Draws a Line from the top-left to the bottom-right
# corner of a cell.
# * cross_up: Draws a Line from the bottom-left to the top-right
# #cross_up:: Draws a Line from the bottom-left to the top-right
# corner of a cell.
# * hidden: The cell is hidden.
# * locked: The cell is locked.
# * merge_range: The cell is in a merged range.
# * shrink: Shrink the contents to fit the cell.
# * text_justlast: Force the last line of a cell to be justified. This
# #hidden:: The cell is hidden.
# #locked:: The cell is locked.
# #merge_range:: The cell is in a merged range.
# #shrink:: Shrink the contents to fit the cell.
# #text_justlast:: Force the last line of a cell to be justified. This
# probably makes sense if horizontal_align = :justify
# * left: Draw a border to the left of the cell.
# * right: Draw a border to the right of the cell.
# * top: Draw a border at the top of the cell.
# * bottom: Draw a border at the bottom of the cell.
# * rotation_stacked: Characters in the cell are stacked on top of each other.
# Excel will ignore other rotation values if this is set.
# #left:: Draw a border to the left of the cell.
# #right:: Draw a border to the right of the cell.
# #top:: Draw a border at the top of the cell.
# #bottom:: Draw a border at the bottom of the cell.
# #rotation_stacked:: Characters in the cell are stacked on top of each
# other. Excel will ignore other rotation values if
# this is set.
boolean :cross_down, :cross_up, :hidden, :locked,
:merge_range, :shrink, :text_justlast, :text_wrap, :left, :right,
:top, :bottom, :rotation_stacked
Expand Down Expand Up @@ -101,6 +101,7 @@ def initialize opts={}
# first valid value (e.g. Format#align = :justify only sets the horizontal
# alignment. Use one of the aliases prefixed with :v if you need to
# disambiguate.)
#
# This is essentially a backward-compatibility method and may be removed at
# some point in the future.
def align= location
Expand Down Expand Up @@ -134,7 +135,7 @@ def border_color=(color)
##
# Set the Text rotation
# Valid values: Integers from -90 to 90,
# or :stacked (sets #rotation_stacked to true)
# or :stacked (sets #rotation_stacked to true)
def rotation=(rot)
if rot.to_s.downcase == 'stacked'
@rotation_stacked = true
Expand Down
14 changes: 7 additions & 7 deletions lib/spreadsheet/row.rb
Expand Up @@ -8,12 +8,12 @@ module Spreadsheet
# DateTime-handling in Excel::Row#[]
#
# Useful Attributes are:
# * #idx The 0-based index of this Row in its Worksheet.
# * #formats A parallel array containing Formatting information for
# all cells stored in a Row.
# * #default_format The default Format used when writing a Cell if no explicit
# Format is stored in #formats for the cell.
# * #height The height of this Row in points (defaults to 12).
# #idx:: The 0-based index of this Row in its Worksheet.
# #formats:: A parallel array containing Formatting information for
# all cells stored in a Row.
# #default_format:: The default Format used when writing a Cell if no explicit
# Format is stored in #formats for the cell.
# #height:: The height of this Row in points (defaults to 12).
class Row < Array
class << self
def updater *keys
Expand Down Expand Up @@ -52,7 +52,7 @@ def default_format= format
end
##
# #first_unused (really last used + 1) - the 0-based index of the first of
# all remaining contiguous blank Cells.
# all remaining contiguous blank Cells.
alias :first_unused :size
##
# #first_used the 0-based index of the first non-blank Cell.
Expand Down
7 changes: 4 additions & 3 deletions lib/spreadsheet/workbook.rb
Expand Up @@ -7,9 +7,9 @@ module Spreadsheet
# for all Spreadsheet manipulation.
#
# Interesting Attributes:
# * #default_format - The default format used for all cells in this Workbook.
# that have no format set explicitly or in
# Row#default_format or Worksheet#default_format.
# #default_format:: The default format used for all cells in this Workbook.
# that have no format set explicitly or in
# Row#default_format or Worksheet#default_format.
class Workbook
include Encodings
attr_reader :io, :worksheets, :formats, :fonts
Expand Down Expand Up @@ -47,6 +47,7 @@ def add_worksheet worksheet
# Create a new Worksheet in this Workbook.
# Used without options this creates a Worksheet with the name 'WorksheetN'
# where the new Worksheet is the Nth Worksheet in this Workbook.
#
# Use the option <em>:name => 'My pretty Name'</em> to override this
# behavior.
def create_worksheet opts = {}
Expand Down
25 changes: 13 additions & 12 deletions lib/spreadsheet/worksheet.rb
Expand Up @@ -7,13 +7,13 @@ module Spreadsheet
# The Worksheet class. Contains most of the Spreadsheet data in Rows.
#
# Interesting Attributes
# * #name - The Name of this Worksheet.
# * #default_format - The default format used for all cells in this Workhseet
# that have no format set explicitly or in
# Row#default_format.
# * #rows - The Rows in this Worksheet. It is not recommended to
# Manipulate this Array directly. If you do, call
# #updated_from with the smallest modified index.
# #name :: The Name of this Worksheet.
# #default_format:: The default format used for all cells in this Workhseet
# that have no format set explicitly or in
# Row#default_format.
# #rows :: The Rows in this Worksheet. It is not recommended to
# Manipulate this Array directly. If you do, call
# #updated_from with the smallest modified index.
class Worksheet
include Encodings
attr_accessor :name, :workbook
Expand Down Expand Up @@ -63,17 +63,18 @@ def default_format= format
format
end
##
# Dimensions: [ first used row, first unused row,
# first used column, first unused column ]
# ( First used means that all rows or columns before that are
# empty. First unused means that this and all following rows
# or columns are empty. )
# Dimensions:: [ first used row, first unused row,
# first used column, first unused column ]
# ( First used means that all rows or columns before that are
# empty. First unused means that this and all following rows
# or columns are empty. )
def dimensions
@dimensions || recalculate_dimensions
end
##
# If no argument is given, #each iterates over all used Rows (from the first
# used Row until but omitting the first unused Row, see also #dimensions).
#
# If the argument skip is given, #each iterates from that row until but
# omitting the first unused Row, effectively skipping the first _skip_ Rows
# from the top of the Worksheet.
Expand Down

0 comments on commit 945cccf

Please sign in to comment.