report 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 0.1.0 / 2012-07-10
2
+
3
+ * Enhancements
4
+
5
+ * In XLSX output, freeze panes underneath first row of body
6
+ * In PDF output, make table body headers bold
7
+
1
8
  0.0.3 / 2012-07-06
2
9
 
3
10
  * Bug fixes
@@ -18,7 +18,8 @@ class Report
18
18
  DEFAULT_HEAD = {}
19
19
  DEFAULT_BODY = {
20
20
  :width => (10*72),
21
- :header => true
21
+ :header => true,
22
+ :cell_style => { :inline_format => true },
22
23
  }
23
24
  DEFAULT_NUMBER_PAGES = [
24
25
  'Page <page> of <total>',
@@ -91,7 +92,7 @@ class Report
91
92
  def make_body(src)
92
93
  return unless src
93
94
  memo = []
94
- memo << src.columns.map(&:name)
95
+ memo << src.columns.map { |c| "<b>#{c.name}</b>" }
95
96
  src.each(report) do |row|
96
97
  memo << convert_row(row)
97
98
  end
@@ -1,3 +1,3 @@
1
1
  class Report
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -34,6 +34,7 @@ class Report
34
34
  table._body.each(report) do |row|
35
35
  sheet.add_row row.to_hash
36
36
  end
37
+ sheet.freeze_top_left = calculate_top_left(cursor)
37
38
  sheet.add_autofilter calculate_autofilter(table, cursor)
38
39
  end
39
40
  end
@@ -47,6 +48,9 @@ class Report
47
48
  end
48
49
 
49
50
  private
51
+ def calculate_top_left(cursor)
52
+ [ 'A', cursor+1 ].join
53
+ end
50
54
  def calculate_autofilter(table, cursor)
51
55
  [ 'A', cursor, ':', XlsxWriter::Cell.excel_column_letter(table._body.columns.length-1), cursor ].join
52
56
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.version = Report::VERSION
18
18
 
19
19
  gem.add_runtime_dependency 'activesupport'
20
- gem.add_runtime_dependency 'xlsx_writer', '>=0.2.2'
20
+ gem.add_runtime_dependency 'xlsx_writer', '>=0.3.1'
21
21
  gem.add_runtime_dependency 'prawn'
22
22
  gem.add_runtime_dependency 'posix-spawn'
23
23
 
@@ -313,6 +313,12 @@ describe Report do
313
313
  how_to_say_hello[1]['Language'].should == 'Russian'
314
314
  how_to_say_hello[1]['Content'].should == 'Здравствуйте'
315
315
  end
316
+ it "freezes the pane under the first row of the body" do
317
+ path = UnixUtils.unzip A2.new.xlsx.path
318
+ xml = File.read("#{path}/xl/worksheets/sheet1.xml")
319
+ xml.should include('topLeftCell="A2"')
320
+ xml.should include('ySplit="1"')
321
+ end
316
322
  it "puts a blank row between head and body" do
317
323
  transl_with_head = RemoteTable.new A3.new.xlsx.path, :headers => false, :keep_blank_rows => true
318
324
  transl_with_head[0][0].should == "Report type"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 0.2.2
37
+ version: 0.3.1
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 0.2.2
45
+ version: 0.3.1
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: prawn
48
48
  requirement: !ruby/object:Gem::Requirement