### Home Classes Methods

### In Files

- lib/spreadsheet/font.rb

### Parent

Object

### Methods

- ::new
- #bold=
- #italic
- #weight

### Included Modules

- Spreadsheet::Datatypes
- Spreadsheet::Encodings

### Files

- LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Spreadsheet
- Spreadsheet::Column
- Spreadsheet::Compatibility
- Spreadsheet::Datatypes
- Spreadsheet::Encodings
- Spreadsheet::Excel
- Spreadsheet::Excel::Error
- Spreadsheet::Excel::ExcelCompatibleWorkbook
- Spreadsheet::Excel::Internals
- Spreadsheet::Excel::Internals::Biff5
- Spreadsheet::Excel::Internals::Biff8
- Spreadsheet::Excel::Offset
- Spreadsheet::Excel::Password
- Spreadsheet::Excel::Reader
- Spreadsheet::Excel::Reader::Biff5
- Spreadsheet::Excel::Rgb
- Spreadsheet::Excel::Row
- Spreadsheet::Excel::SstEntry
- Spreadsheet::Excel::Workbook
- Spreadsheet::Excel::Worksheet
- Spreadsheet::Font
- Spreadsheet::Format
- Spreadsheet::Formula
- Spreadsheet::Helpers
- Spreadsheet::Link
- Spreadsheet::Note
- Spreadsheet::NoteObject
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::Worksheet
- Spreadsheet::ParseExcel::Worksheet::Cell
- Spreadsheet::Row
- Spreadsheet::Workbook
- Spreadsheet::Worksheet
- Spreadsheet::Writer

No matching classes.

# Spreadsheet::Font

Font formatting data

### Attributes

name[RW]

### Public Class Methods

new(name, opts={}) click to toggle source

    # File lib/spreadsheet/font.rb, line 63
    def initialize name, opts={}
      self.name = name
      @color = :text
      @previous_fast_key = nil
      @size = nil
      @weight = nil
      @italic = nil
      @strikeout = nil
      @outline = nil
      @shadow = nil
      @escapement = nil
      @underline = nil
      @family = nil
      @encoding = nil
      opts.each do |key, val|
        self.send "#{key}=", val
      end
    end

### Public Instance Methods

bold=(bool) click to toggle source

Sets weight to :bold if(bool), :normal otherwise.

    # File lib/spreadsheet/font.rb, line 83
    def bold= bool
      self.weight = bool ? :bold : nil
    end

italic click to toggle source

You can set the following boolean Font attributes

- italic

- strikeout

- outline

- shadow

    # File lib/spreadsheet/font.rb, line 17
    boolean :italic, :strikeout, :outline, :shadow

weight click to toggle source

Font weight Valid values: :normal, :bold or any positive Integer. In Excel:

    100 <= weight <= 1000
    :bold   => 700
    :normal => 400

Default: :normal

    # File lib/spreadsheet/font.rb, line 29
    enum :weight, :normal, :bold, Integer, :bold => :b

[Validate]

Generated with the Darkfish Rdoc Generator 2.