Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Merge pull request #19 from kellyredding/new-api
Browse files Browse the repository at this point in the history
1.0 API
  • Loading branch information
kellyredding committed Mar 15, 2012
2 parents 11103a1 + 7e2ab0d commit db39788
Show file tree
Hide file tree
Showing 70 changed files with 2,615 additions and 2,325 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ PATH
specs:
osheet (0.10.0)
enumeration (~> 1.3)
xmlss (~> 0.4)
xmlss (~> 1.0.0.rc)

GEM
remote: http://rubygems.org/
specs:
ansi (1.4.1)
ansi (1.4.2)
assert (0.7.3)
assert-view (~> 0.5)
assert-view (0.5.0)
Expand All @@ -17,12 +17,12 @@ GEM
enumeration (1.3.1)
rake (0.9.2.2)
ruby-prof (0.10.8)
undies (2.1.0)
undies (2.2.1)
whysoslow (0.0.2)
ansi (~> 1.4)
xmlss (0.4.0)
xmlss (1.0.0.rc.1)
enumeration (~> 1.3)
undies (~> 2.1)
undies (~> 2.2.1)

PLATFORMS
ruby
Expand Down
11 changes: 7 additions & 4 deletions bench/bench_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def run
}

outstream = StringIO.new(out = "")
outstream << Osheet::Workbook.new {
outstream << Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2), {
:bench_row_count => @row_count,
:runner => @runner
}) {
title "bench"

template(:row, :header) {
Expand Down Expand Up @@ -58,13 +61,13 @@ def run
row :header

10.times do |i|
(@row_count / 10).times do
(bench_row_count / 10).times do
row :data, data_values
end
@runner.snapshot("#{((i+1)*10).to_s.rjust(3)}%")
runner.snapshot("#{((i+1)*10).to_s.rjust(3)}%")
end
}
}.to_data(:pp => 2)
}.to_data
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

puts "building examples/basic.rb ..."

Osheet::Workbook.new {
Osheet::Workbook.new(Osheet::XmlssWriter.new) {
title "basic"
worksheet {
name "Stats: #{fields.join(', ')}"
Expand Down
3 changes: 2 additions & 1 deletion examples/basic.xls
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"><Styles></Styles><Worksheet ss:Name="Stats Sex, Age, Height, Weight"><Table><Column ss:Width="200" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Row><Cell ss:MergeAcross="4"><Data ss:Type="String">Stats: Sex, Age, Height, Weight</Data></Cell></Row><Row><Cell ss:MergeAcross="4"><Data ss:Type="String"></Data></Cell></Row><Row><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Sex</Data></Cell><Cell><Data ss:Type="String">Age</Data></Cell><Cell><Data ss:Type="String">Height</Data></Cell><Cell><Data ss:Type="String">Weight</Data></Cell></Row><Row><Cell><Data ss:Type="String">Sally</Data></Cell><Cell><Data ss:Type="String">F</Data></Cell><Cell><Data ss:Type="Number">29</Data></Cell><Cell><Data ss:Type="String">5'3"</Data></Cell><Cell><Data ss:Type="String">132 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Dick</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">33</Data></Cell><Cell><Data ss:Type="String">6'5"</Data></Cell><Cell><Data ss:Type="String">243 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Tom</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">52</Data></Cell><Cell><Data ss:Type="String">6'2"</Data></Cell><Cell><Data ss:Type="String">220 lbs.</Data></Cell></Row></Table></Worksheet></Workbook>
<?xml version="1.0" encoding="UTF-8"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"><Styles></Styles><Worksheet ss:Name="Stats Sex, Age, Height, Weight"><Table><Column ss:Width="200" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Row><Cell ss:MergeAcross="4"><Data ss:Type="String">Stats: Sex, Age, Height, Weight</Data></Cell></Row><Row><Cell ss:MergeAcross="4"><Data ss:Type="String"></Data></Cell></Row><Row><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Sex</Data></Cell><Cell><Data ss:Type="String">Age</Data></Cell><Cell><Data ss:Type="String">Height</Data></Cell><Cell><Data ss:Type="String">Weight</Data></Cell></Row><Row><Cell><Data ss:Type="String">Sally</Data></Cell><Cell><Data ss:Type="String">F</Data></Cell><Cell><Data ss:Type="Number">29</Data></Cell><Cell><Data ss:Type="String">5&#x27;3&quot;</Data></Cell><Cell><Data ss:Type="String">132 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Dick</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">33</Data></Cell><Cell><Data ss:Type="String">6&#x27;5&quot;</Data></Cell><Cell><Data ss:Type="String">243 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Tom</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">52</Data></Cell><Cell><Data ss:Type="String">6&#x27;2&quot;</Data></Cell><Cell><Data ss:Type="String">220 lbs.</Data></Cell></Row></Table></Worksheet></Workbook>
4 changes: 2 additions & 2 deletions examples/basic_with_templates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

puts "building examples/basic_with_templats.rb ..."

Osheet::Workbook.new {
Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2)) {
title "basic"

template(:column, :data) { |field, index|
Expand Down Expand Up @@ -82,6 +82,6 @@
row :data, name, stats
end
}
}.to_file('examples/basic_with_templates.xls', :pp => 2)
}.to_file('examples/basic_with_templates.xls')

puts "open examples/basic_with_templates.xls"
6 changes: 3 additions & 3 deletions examples/basic_with_templates.xls
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<Data ss:Type="Number">29</Data>
</Cell>
<Cell>
<Data ss:Type="String">5'3"</Data>
<Data ss:Type="String">5&#x27;3&quot;</Data>
</Cell>
<Cell>
<Data ss:Type="String">132 lbs.</Data>
Expand All @@ -65,7 +65,7 @@
<Data ss:Type="Number">33</Data>
</Cell>
<Cell>
<Data ss:Type="String">6'5"</Data>
<Data ss:Type="String">6&#x27;5&quot;</Data>
</Cell>
<Cell>
<Data ss:Type="String">243 lbs.</Data>
Expand All @@ -82,7 +82,7 @@
<Data ss:Type="Number">52</Data>
</Cell>
<Cell>
<Data ss:Type="String">6'2"</Data>
<Data ss:Type="String">6&#x27;2&quot;</Data>
</Cell>
<Cell>
<Data ss:Type="String">220 lbs.</Data>
Expand Down
4 changes: 2 additions & 2 deletions examples/formats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

puts "building examples/formats.rb ..."

Osheet::Workbook.new {
Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2)) {
title "formats"


Expand Down Expand Up @@ -365,6 +365,6 @@



}.to_file('examples/formats.xls', :pp => 2)
}.to_file('examples/formats.xls')

puts "open examples/formats.xls"
92 changes: 46 additions & 46 deletions examples/formats.xls
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
<Style ss:ID="..scientific_none_8_comma_redparenth">
<NumberFormat ss:Format="#,##0.00000000E+00_);[Red](#,##0.00000000E+00)" />
</Style>
<Style ss:ID="..fraction_threedigits">
<NumberFormat ss:Format="# ???/???" />
</Style>
<Style ss:ID="..fraction_hundredths">
<NumberFormat ss:Format="# ??/100" />
</Style>
<Style ss:ID="..fraction_halves">
<NumberFormat ss:Format="# ?/2" />
</Style>
Expand All @@ -82,12 +88,6 @@
<Style ss:ID="..fraction_tenths">
<NumberFormat ss:Format="# ?/10" />
</Style>
<Style ss:ID="..fraction_threedigits">
<NumberFormat ss:Format="# ???/???" />
</Style>
<Style ss:ID="..fraction_hundredths">
<NumberFormat ss:Format="# ??/100" />
</Style>
<Style ss:ID="..text">
<NumberFormat ss:Format="@" />
</Style>
Expand Down Expand Up @@ -447,6 +447,22 @@
<Data ss:Type="String">Fraction Example</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">fraction_threedigits</Data>
</Cell>
<Cell ss:StyleID="..fraction_threedigits">
<Data ss:Type="Number">0.01</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">fraction_hundredths</Data>
</Cell>
<Cell ss:StyleID="..fraction_hundredths">
<Data ss:Type="Number">0.01</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">fraction_halves</Data>
Expand Down Expand Up @@ -503,22 +519,6 @@
<Data ss:Type="Number">0.1</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">fraction_threedigits</Data>
</Cell>
<Cell ss:StyleID="..fraction_threedigits">
<Data ss:Type="Number">0.01</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">fraction_hundredths</Data>
</Cell>
<Cell ss:StyleID="..fraction_hundredths">
<Data ss:Type="Number">0.01</Data>
</Cell>
</Row>
</Table>
</Worksheet>
<Worksheet ss:Name="text, special, custom">
Expand Down Expand Up @@ -600,167 +600,167 @@
<Data ss:Type="String">datetime_m</Data>
</Cell>
<Cell ss:StyleID="..datetime_m">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_d</Data>
</Cell>
<Cell ss:StyleID="..datetime_d">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_y</Data>
</Cell>
<Cell ss:StyleID="..datetime_y">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mm</Data>
</Cell>
<Cell ss:StyleID="..datetime_mm">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_dd</Data>
</Cell>
<Cell ss:StyleID="..datetime_dd">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_yy</Data>
</Cell>
<Cell ss:StyleID="..datetime_yy">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_yyyy</Data>
</Cell>
<Cell ss:StyleID="..datetime_yyyy">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mm/dd/yy</Data>
<Data ss:Type="String">datetime_mm&#x2F;dd&#x2F;yy</Data>
</Cell>
<Cell ss:StyleID="..datetime_mm/dd/yy">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mm/dd/yyyy</Data>
<Data ss:Type="String">datetime_mm&#x2F;dd&#x2F;yyyy</Data>
</Cell>
<Cell ss:StyleID="..datetime_mm/dd/yyyy">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mmmm</Data>
</Cell>
<Cell ss:StyleID="..datetime_mmmm">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mmmmm</Data>
</Cell>
<Cell ss:StyleID="..datetime_mmmmm">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mmmmm</Data>
</Cell>
<Cell ss:StyleID="..datetime_mmmmm">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_h</Data>
</Cell>
<Cell ss:StyleID="..datetime_h">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_m</Data>
</Cell>
<Cell ss:StyleID="..datetime_m">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_s</Data>
</Cell>
<Cell ss:StyleID="..datetime_s">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_hh</Data>
</Cell>
<Cell ss:StyleID="..datetime_hh">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_mm</Data>
</Cell>
<Cell ss:StyleID="..datetime_mm">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_ss</Data>
</Cell>
<Cell ss:StyleID="..datetime_ss">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_h:mm:ss</Data>
</Cell>
<Cell ss:StyleID="..datetime_h:mm:ss">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_h:mm:ss.0</Data>
</Cell>
<Cell ss:StyleID="..datetime_h:mm:ss.0">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">datetime_hh:mm:ss AM/PM</Data>
<Data ss:Type="String">datetime_hh:mm:ss AM&#x2F;PM</Data>
</Cell>
<Cell ss:StyleID="..datetime_hh:mm:ss AM/PM">
<Data ss:Type="DateTime">2012-01-09T00:00:00</Data>
<Data ss:Type="DateTime">2012-03-14T00:00:00</Data>
</Cell>
</Row>
</Table>
Expand Down
Loading

0 comments on commit db39788

Please sign in to comment.