Sha256: 40c080c63758478cfaf1048c807f53e731db68647907129abf43f1ce2e95603a

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require_relative './xlsx-func-testcase'

class TestSimple < XlsxWriterTestCase
  test 'simple01' do |wb|
    ws = wb.add_worksheet

    ws.write_string(0, 0, 'Hello')
    ws.write_number(1, 0, 123)
  end

  test 'simple02' do |wb|
    ws1 = wb.add_worksheet
    ws2 = wb.add_worksheet('Data Sheet')
    ws3 = wb.add_worksheet

    wb.add_format(:bold, bold: true)

    ws1.write_string(0, 0, 'Foo')
    ws1.write_number(1, 0, 123)

    ws3.write_string('1', '1', 'Foo')
    ws3.write_string('2', 'B', 'Bar', :bold)
    ws3.write_number('3', 2, 234)
  end

  test 'simple03' do |wb|
    ws1 = wb.add_worksheet
    ws2 = wb.add_worksheet("Data Sheet")
    ws3 = wb.add_worksheet

    wb.add_format(:bold, bold: true);

    ws1.write_string(0, 'A', 'Foo')
    ws1.write_number(1, 'A', 123)

    ws3.write_string(1, 'B', 'Foo')
    ws3.write_string(2, 'B', 'Bar', :bold)
    ws3.write_number('C4', 234)

    # Ensure the active worksheet is overwritten, below.
    x = ws2.activate

    y = ws2.select
    y = ws3.select
    y = ws3.activate
  end

  test 'simple04' do |wb|
    datetime1 = Time.new(0,    1,  1, 12)
    datetime2 = Time.new(2013, 1, 27,  0)

    ws = wb.add_worksheet

    wb.add_format(:f1, num_format_index: 20)
    wb.add_format(:f2, num_format_index: 14)

    ws.set_column(0, 0, width: 12)

    ws.write_datetime('A1', datetime1, :f1)
    ws.write_datetime(1, 0, datetime2, :f2)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xlsxwriter-0.2.1.pre.2 test/test-simple.rb
xlsxwriter-0.2.1.pre test/test-simple.rb
xlsxwriter-0.2.0 test/test-simple.rb
xlsxwriter-0.2.0.pre.2 test/test-simple.rb
xlsxwriter-0.2.0.pre test/test-simple.rb
xlsxwriter-0.1.2.pre test/test-simple.rb
xlsxwriter-0.1.1 test/test-simple.rb
xlsxwriter-0.1.0 test/test-simple.rb