rods 0.6.1 → 0.6.2
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 +54 -6
- data/Rakefile +1 -1
- data/lib/rods.rb +27 -3
- data/rods.gemspec +1 -1
- metadata +3 -3
data/README
CHANGED
@@ -14,10 +14,17 @@
|
|
14
14
|
Licensed under the same terms as Ruby. No warranty is provided.
|
15
15
|
|
16
16
|
= Changelog
|
17
|
+
* 0.6.2
|
18
|
+
* added style-attributes
|
19
|
+
* text-underline-style
|
20
|
+
* text-underline-width
|
21
|
+
* text-underline-color
|
22
|
+
cf. Example 0.6.2
|
17
23
|
* 0.6.1
|
18
24
|
* added new functions
|
19
25
|
* insertTableBefore()
|
20
26
|
* insertTableAfter()
|
27
|
+
cf. Example 0.6.1
|
21
28
|
* 0.6.0
|
22
29
|
* changed interface from
|
23
30
|
* getNextRow, getPreviousRow, getNextCell, getPreviousCell to
|
@@ -37,12 +44,8 @@
|
|
37
44
|
* logging set as default
|
38
45
|
|
39
46
|
= Disclaimer
|
40
|
-
At the time of this publishing and stage of development RODS just suits my personal needs
|
41
|
-
* to provide an intuitively to use, purpose oriented interface for
|
42
|
-
* automating most of the tasks I personally encountered so far.
|
43
47
|
|
44
|
-
The code
|
45
|
-
At the time of this writing the script 'example.rb' provided in commented version below proved to work for
|
48
|
+
The example code was tested on
|
46
49
|
* Linux
|
47
50
|
* Ubuntu 10.10 64-Bit (German)
|
48
51
|
* OpenOffice.org 3.2 (German)
|
@@ -276,6 +279,51 @@
|
|
276
279
|
end
|
277
280
|
end
|
278
281
|
|
282
|
+
= Example for additions in 0.6.1
|
283
|
+
|
284
|
+
#!/usr/bin/ruby
|
285
|
+
# coding: UTF-8
|
286
|
+
#
|
287
|
+
# Author: Dr. Heinz Breinlinger
|
288
|
+
#
|
289
|
+
require 'rubygems'
|
290
|
+
require 'rods'
|
291
|
+
|
292
|
+
mySheet=Rods.new("Template.ods")
|
293
|
+
mySheet.insertTableAfter("Tabelle1","Neue Tabelle")
|
294
|
+
mySheet.insertTableAfter("Neue Tabelle","Neue Tabelle2")
|
295
|
+
mySheet.insertTableAfter("Neue Tabelle2","Neue Tabelle3")
|
296
|
+
mySheet.insertTableAfter("Tabelle3","Neue Tabelle4")
|
297
|
+
mySheet.insertTableBefore("Tabelle1","Vor1")
|
298
|
+
mySheet.insertTableBefore("Neue Tabelle4","Vor4")
|
299
|
+
mySheet.saveAs("Test2.ods")
|
300
|
+
puts("done")
|
301
|
+
|
302
|
+
= Example for additions in 0.6.2
|
303
|
+
|
304
|
+
#!/usr/bin/ruby
|
305
|
+
# coding: UTF-8
|
306
|
+
#
|
307
|
+
# Author: Dr. Heinz Breinlinger
|
308
|
+
#
|
309
|
+
require 'rubygems'
|
310
|
+
require 'rods'
|
311
|
+
|
312
|
+
mySheet=Rods.new("Template.ods")
|
313
|
+
cell=mySheet.writeGetCell(3,3,"string","Underline")
|
314
|
+
mySheet.setAttributes(cell,{ "style:text-underline-color" => "blue",
|
315
|
+
"style:text-underline-style" => "solid",
|
316
|
+
"style:text-underline-width" => "auto"})
|
317
|
+
cell=mySheet.writeGetCell(4,4,"string","Underline_Default_with_Black")
|
318
|
+
#----------------------------------------------------------------------
|
319
|
+
# if not specified otherwise, widt and color are set to default
|
320
|
+
# - black
|
321
|
+
# - solid
|
322
|
+
#----------------------------------------------------------------------
|
323
|
+
mySheet.setAttributes(cell,{ "style:text-underline-style" => "solid" })
|
324
|
+
mySheet.saveAs("Test3.ods")
|
325
|
+
puts("done")
|
326
|
+
|
279
327
|
= Caveat
|
280
328
|
|
281
329
|
The XML-structure of a <file>.ods is
|
@@ -286,7 +334,7 @@
|
|
286
334
|
|
287
335
|
1.upto(500){ |i|
|
288
336
|
text1,type1=readCell(i,3) # XML-Parser starts from the top-node
|
289
|
-
text2,type2=readCell(i,4) # XML-Parser starts
|
337
|
+
text2,type2=readCell(i,4) # XML-Parser starts from the top-node
|
290
338
|
puts("Read #{text1} of #{type1} and #{text2} of #{type2}")
|
291
339
|
}
|
292
340
|
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('rods', '0.6.
|
5
|
+
Echoe.new('rods', '0.6.2') do |p|
|
6
6
|
p.description = "OpenOffice.org oocalc: Fast automated batch-processing of spreadsheets (*.ods) conforming to Open Document Format v1.1. used by e.g. OpenOffice.org and LibreOffice. Please see screenshot and Rdoc-Documentation at http://ruby.homelinux.com/ruby/rods/. You can contact me at rodsdotrubyatonlinedotde (and drop me a line, if you like it ;-)"
|
7
7
|
p.summary = "Automation of OpenOffice/LibreOffice by batch-processing of spreadsheets conforming to Open Document v1.1"
|
8
8
|
p.url = "http://ruby.homelinux.com/ruby/rods/"
|
data/lib/rods.rb
CHANGED
@@ -1193,12 +1193,13 @@ class Rods
|
|
1193
1193
|
#---------------------------------------------------------------------
|
1194
1194
|
# Ersetzung von Farbwerten
|
1195
1195
|
#---------------------------------------------------------------------
|
1196
|
-
if((key == "color") || (key == "fo:color") || (key == "background-color") || (key == "fo:background-color"))
|
1196
|
+
if((key == "color") || (key == "fo:color") || (key == "background-color") || (key == "fo:background-color") || (key == "text-underline-color") || (key == "style:text-underline-color"))
|
1197
1197
|
#-------------------------------------------------------
|
1198
1198
|
# Falls Farbwert nicht hexadezimal angegeben (i.e. '#' zu Beginn),
|
1199
1199
|
# => in Farbpalette nachschlagen, ggf. Fehlermeldung
|
1200
1200
|
#-------------------------------------------------------
|
1201
|
-
if(!value.match(/^#/)) then value=getColor(value)
|
1201
|
+
if(!value.match(/^#/)) then value=getColor(value)
|
1202
|
+
end
|
1202
1203
|
#--------------------------------------------------------
|
1203
1204
|
# dito bei Farben fuer den Rand
|
1204
1205
|
#--------------------------------------------------------
|
@@ -1237,6 +1238,9 @@ class Rods
|
|
1237
1238
|
when "font-style" then outHash["fo:font-style"] = value
|
1238
1239
|
when "font-weight" then outHash["fo:font-weight"] = value
|
1239
1240
|
when "data-style-name" then outHash["style:data-style-name"] = value
|
1241
|
+
when "text-underline-style" then outHash["style:text-underline-style"] = value
|
1242
|
+
when "text-underline-width" then outHash["style:text-underline-width"] = value
|
1243
|
+
when "text-underline-color" then outHash["style:text-underline-color"] = value
|
1240
1244
|
#-------------------------------------
|
1241
1245
|
# andernfalls Key und Value kopieren
|
1242
1246
|
#-------------------------------------
|
@@ -1464,6 +1468,25 @@ class Rods
|
|
1464
1468
|
die("checkStyleAttributes: internal error: found unnormed or invalid attribute #{key}") unless (key.match(/:/))
|
1465
1469
|
}
|
1466
1470
|
#--------------------------------------------------------
|
1471
|
+
# Unterstrich ggf. mit Defaultwerten auffüllen
|
1472
|
+
#--------------------------------------------------------
|
1473
|
+
if(attributes.has_key?("style:text-underline-style"))
|
1474
|
+
if(! attributes.has_key?("style:text-underline-width"))
|
1475
|
+
attributes["style:text-underline-width"]="auto"
|
1476
|
+
puts("checkStyleAttributes: automatically set style:text-underline-width to 'auto'")
|
1477
|
+
end
|
1478
|
+
if(! attributes.has_key?("style:text-underline-color"))
|
1479
|
+
attributes["style:text-underline-color"]="#000000" # schwarz
|
1480
|
+
puts("checkStyleAttributes: automatically set style:text-underline-color to 'black'")
|
1481
|
+
end
|
1482
|
+
end
|
1483
|
+
#-------------------------------------------------------------
|
1484
|
+
# style:text-underline-style ist Pflicht !
|
1485
|
+
#-------------------------------------------------------------
|
1486
|
+
if((attributes.has_key?("style:text-underline-width") || attributes.has_key?("style:text-underline-color")) && (! attributes.has_key?("style:text-underline-style")))
|
1487
|
+
die("checkStyleAttributes: missing (style:)text-underline-style ... please specify")
|
1488
|
+
end
|
1489
|
+
#--------------------------------------------------------
|
1467
1490
|
# fo:font-style und fo:font-weight vereinheitlichen (asiatisch/komplex)
|
1468
1491
|
#--------------------------------------------------------
|
1469
1492
|
fontStyle=attributes["fo:font-style"]
|
@@ -1563,7 +1586,8 @@ class Rods
|
|
1563
1586
|
# style:text-properties
|
1564
1587
|
#------------------------------------------------------------------------
|
1565
1588
|
when "fo:color","fo:font-style","fo:font-style-asian","fo:font-style-complex",
|
1566
|
-
"fo:font-weight","fo:font-weight-asian","fo:font-weight-complex"
|
1589
|
+
"fo:font-weight","fo:font-weight-asian","fo:font-weight-complex","style:text-underline-style",
|
1590
|
+
"style:text-underline-width","style:text-underline-color"
|
1567
1591
|
textProperties=style.add_element("style:text-properties") unless (textProperties)
|
1568
1592
|
textProperties.attributes[key]=value
|
1569
1593
|
#---------------------------------------------------------
|
data/rods.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dr. Heinz Breinlinger
|