ru_excel 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README ADDED
@@ -0,0 +1,21 @@
1
+ = ru_excel
2
+
3
+ ru_excel is a library for genreration MsExcel files.
4
+ It is a port of pyExcelerator tunned for fast file generation (in fact it even faster than pyExcelerator)
5
+
6
+ Currently it doesn't support formulas, sorry.
7
+
8
+ Home page: http://github.com/funny-falcon/ru_excel
9
+
10
+ == Documentation
11
+
12
+ API is mostly ported from pyExcelerator, so that you can reference to it (and xlwt)
13
+
14
+ == ToDo
15
+
16
+ - Port fixes from xlwt
17
+ - Add support for Formulas
18
+
19
+ == Copyright
20
+
21
+ Copyright by Sokolov Yura aka funny_falcon
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ #desc 'Generate documentation for the ru_excel plugin.'
6
+ #Rake::RDocTask.new(:rdoc) do |rdoc|
7
+ # rdoc.rdoc_dir = 'rdoc'
8
+ # rdoc.title = 'IdentityMap'
9
+ # rdoc.options << '--line-numbers' << '--inline-source'
10
+ # rdoc.rdoc_files.include('README')
11
+ # rdoc.rdoc_files.include('lib/**/*.rb')
12
+ #end
13
+
14
+ begin
15
+ require 'jeweler'
16
+ Jeweler::Tasks.new do |gemspec|
17
+ gemspec.name = "ru_excel"
18
+ gemspec.summary = "Fast writting of MsExcel files (port of pyExcelerator)"
19
+ gemspec.description = "Port of pyExcelerator tunned for faster .xls generation"
20
+ gemspec.email = "funny.falcon@gmail.com"
21
+ gemspec.homepage = "http://github.com/funny-falcon/ru_excel"
22
+ gemspec.authors = ["Sokolov Yura aka funny_falcon"]
23
+ #gemspec.add_dependency('')
24
+ gemspec.rubyforge_project = 'ru-excel'
25
+ end
26
+ Jeweler::GemcutterTasks.new
27
+ Jeweler::RubyforgeTasks.new
28
+ rescue LoadError
29
+ puts "Jeweler not available. Install it with: gem install jeweler"
30
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.6
@@ -0,0 +1,35 @@
1
+ $: << '.'
2
+ require 'ru_excel'
3
+
4
+ style = Excel::XFStyle.new()
5
+
6
+ wb = Excel::Workbook.new()
7
+ ws0 = wb.add_sheet('0')
8
+
9
+ colcount = 200 + 1
10
+ rowcount = 800 + 1
11
+
12
+ t0 = Time.now
13
+ puts "\nstart: %s" % t0.to_s
14
+
15
+ puts "Filling..."
16
+ for col in 0...colcount
17
+ puts "[%d]" % col if col % 10 == 0
18
+ for row in 0...rowcount
19
+ ws0.write(row, col, "BIG(%d, %d)" % [row, col])
20
+ #ws0.write(row, col, "BIG")
21
+ end
22
+ end
23
+
24
+ t1 = Time.now.to_f - t0.to_f
25
+ puts "\nsince starting elapsed %.2f s" % (t1)
26
+
27
+ puts "Storing..."
28
+ File.open('big-16Mb1.xls','wb')do|f|
29
+ wb.save(f)
30
+ end
31
+
32
+ t2 = Time.now.to_f - t0.to_f
33
+ puts "since starting elapsed %.2f s" % (t2)
34
+
35
+
@@ -0,0 +1,13 @@
1
+ require 'ru_excel'
2
+
3
+ w = Excel::Workbook.new
4
+ ws = w.add_sheet('Multiline')
5
+
6
+ style = Excel::XFStyle.new
7
+ style.alignment.wrap = 1
8
+
9
+ ws.write(1, 1, "line 1 \n line A", style)
10
+
11
+ ws.col(1).width = 8000
12
+
13
+ File.open('multiline1.xls','w'){|f| w.save(f)}
@@ -0,0 +1,12 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'ru_excel'
3
+
4
+ Excel.encoding = 'utf8'
5
+ wb = Excel::Workbook.new
6
+ ws = wb.add_sheet('info')
7
+ headers = ['Договор', 'Клиент', 'Дата', 'Оплачено',
8
+ 'Тип оплаты', 'Услуга']
9
+ headers.each_with_index{|name, i|
10
+ ws.write(1, i, name)
11
+ }
12
+ File.open('utf8.xls','w'){|f| wb.save(f)}