odf-report 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ class Item
14
14
  def self.get_list(quant = 3)
15
15
  r = []
16
16
  (1..quant).each do |i|
17
- r << Item.new(Faker::Number.number(10), Faker::Name.name)
17
+ r << Item.new(Faker::Number.number(digits: 10), Faker::Name.name)
18
18
  end
19
19
  r
20
20
  end
@@ -2,7 +2,7 @@ RSpec.describe "Tables" do
2
2
 
3
3
  before(:context) do
4
4
 
5
- report = ODFReport::Report.new("spec/specs.odt") do |r|
5
+ report = ODFReport::Report.new("spec/templates/specs.odt") do |r|
6
6
 
7
7
  r.add_table('TABLE_02', []) do |t|
8
8
  t.add_column(:column_01, :id)
@@ -15,7 +15,7 @@ RSpec.describe "Templates Types" do
15
15
  end
16
16
 
17
17
  context "template from file" do
18
- let(:report) { ODFReport::Report.new("spec/specs.odt") }
18
+ let(:report) { ODFReport::Report.new("spec/templates/specs.odt") }
19
19
 
20
20
  it "works" do
21
21
 
@@ -29,7 +29,7 @@ RSpec.describe "Templates Types" do
29
29
  end
30
30
 
31
31
  context "template from a String" do
32
- let(:report) { ODFReport::Report.new(io: ::File.open("spec/specs.odt").read) }
32
+ let(:report) { ODFReport::Report.new(io: File.open("spec/templates/specs.odt").read) }
33
33
 
34
34
  it "works" do
35
35
 
Binary file
File without changes
@@ -0,0 +1,32 @@
1
+ require './lib/odf-report'
2
+ require 'ostruct'
3
+ require 'launchy'
4
+
5
+
6
+ @data = []
7
+ @data << OpenStruct.new({ name: "IMG - [1, 1]", path: 'test/templates/images/image_1.jpg', path2: 'test/templates/images/image_1.jpg' })
8
+ @data << OpenStruct.new({ name: "IMG - [2, 1]", path: 'test/templates/images/image_2.jpg', path2: 'test/templates/images/image_1.jpg' })
9
+ @data << OpenStruct.new({ name: "IMG - [3, 2]", path: 'test/templates/images/image_3.jpg', path2: 'test/templates/images/image_2.jpg' })
10
+ @data << OpenStruct.new({ name: "IMG - [1, 3]", path: 'test/templates/images/image_1.jpg', path2: 'test/templates/images/image_3.jpg' })
11
+ @data << OpenStruct.new({ name: "IMG - [2, 2]", path: 'test/templates/images/image_2.jpg', path2: 'test/templates/images/image_2.jpg' })
12
+
13
+ report = ODFReport::Report.new("test/templates/test_images.odt") do |r|
14
+
15
+ r.add_image("graphics2", 'test/templates/rails.png')
16
+ r.add_image("graphics3", 'test/templates/piriapolis.jpg')
17
+
18
+ r.add_table('IMAGE_TABLE', @data) do |t|
19
+ t.add_column(:image_name, :name)
20
+ t.add_image('IMAGE_IN_TABLE', :path)
21
+ t.add_image('IMAGE_2', :path2)
22
+ end
23
+
24
+ r.add_section('SECTION', @data) do |t|
25
+ t.add_field(:image_name, :name)
26
+ t.add_image('IMAGE_IN_SECTION_1', :path)
27
+ t.add_image('IMAGE_IN_SECTION_2', :path2)
28
+ end
29
+
30
+ end
31
+
32
+ report.generate("test/result/test_images.odt")
@@ -0,0 +1,262 @@
1
+ require 'nokogiri'
2
+
3
+ xml = <<-XML
4
+ <?xml version="1.0" encoding="UTF-8"?>
5
+ <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
6
+ <office:scripts/>
7
+ <office:font-face-decls>
8
+ <style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>
9
+ <style:font-face style:name="Arial1" svg:font-family="Arial" style:font-family-generic="swiss"/>
10
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="variable"/>
11
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
12
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/>
13
+ <style:font-face style:name="Arial Unicode MS" svg:font-family="'Arial Unicode MS'" style:font-family-generic="system" style:font-pitch="variable"/>
14
+ <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
15
+ </office:font-face-decls>
16
+ <office:automatic-styles>
17
+ <style:style style:name="TABLE_5f_01" style:display-name="TABLE_01" style:family="table">
18
+ <style:table-properties style:width="16.999cm" table:align="margins"/>
19
+ </style:style>
20
+ <style:style style:name="TABLE_5f_01.A" style:display-name="TABLE_01.A" style:family="table-column">
21
+ <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/>
22
+ </style:style>
23
+ <style:style style:name="TABLE_5f_01.A1" style:display-name="TABLE_01.A1" style:family="table-cell">
24
+ <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/>
25
+ </style:style>
26
+ <style:style style:name="TABLE_5f_01.C1" style:display-name="TABLE_01.C1" style:family="table-cell">
27
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
28
+ </style:style>
29
+ <style:style style:name="TABLE_5f_02" style:display-name="TABLE_02" style:family="table">
30
+ <style:table-properties style:width="16.999cm" table:align="margins"/>
31
+ </style:style>
32
+ <style:style style:name="TABLE_5f_02.A" style:display-name="TABLE_02.A" style:family="table-column">
33
+ <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/>
34
+ </style:style>
35
+ <style:style style:name="TABLE_5f_02.A1" style:display-name="TABLE_02.A1" style:family="table-cell">
36
+ <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/>
37
+ </style:style>
38
+ <style:style style:name="TABLE_5f_02.C1" style:display-name="TABLE_02.C1" style:family="table-cell">
39
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
40
+ </style:style>
41
+ <style:style style:name="TABLE_5f_03" style:display-name="TABLE_03" style:family="table">
42
+ <style:table-properties style:width="16.999cm" table:align="margins"/>
43
+ </style:style>
44
+ <style:style style:name="TABLE_5f_03.A" style:display-name="TABLE_03.A" style:family="table-column">
45
+ <style:table-column-properties style:column-width="5.666cm" style:rel-column-width="21845*"/>
46
+ </style:style>
47
+ <style:style style:name="TABLE_5f_03.A1" style:display-name="TABLE_03.A1" style:family="table-cell">
48
+ <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/>
49
+ </style:style>
50
+ <style:style style:name="TABLE_5f_03.C1" style:display-name="TABLE_03.C1" style:family="table-cell">
51
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
52
+ </style:style>
53
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
54
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
55
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
56
+ </style:style>
57
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard">
58
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
59
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" officeooo:rsid="000bcb7a" officeooo:paragraph-rsid="000bcb7a" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
60
+ </style:style>
61
+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard">
62
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
63
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" officeooo:rsid="000ccec8" officeooo:paragraph-rsid="000ccec8" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
64
+ </style:style>
65
+ <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Standard">
66
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="center" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
67
+ <style:text-properties style:font-name="Arial1" fo:font-size="10pt" fo:language="zxx" fo:country="none" style:font-name-asian="Arial1" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="10pt" style:language-complex="zxx" style:country-complex="none"/>
68
+ </style:style>
69
+ <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Table_20_Contents">
70
+ <style:paragraph-properties fo:text-align="start" style:justify-single-word="false"/>
71
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" officeooo:rsid="000bd2b4" officeooo:paragraph-rsid="000bd2b4" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:font-name-complex="Arial1" style:font-size-complex="12pt"/>
72
+ </style:style>
73
+ <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard">
74
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
75
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" officeooo:rsid="000bcb7a" officeooo:paragraph-rsid="000bcb7a" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
76
+ </style:style>
77
+ <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard">
78
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
79
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" officeooo:rsid="000df62c" officeooo:paragraph-rsid="000df62c" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
80
+ </style:style>
81
+ <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard">
82
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
83
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
84
+ </style:style>
85
+ <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard">
86
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
87
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" fo:language="zxx" fo:country="none" officeooo:paragraph-rsid="000df62c" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
88
+ </style:style>
89
+ <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Standard">
90
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:text-autospace="none"/>
91
+ <style:text-properties style:font-name="Courier New" fo:font-size="14pt" fo:language="zxx" fo:country="none" officeooo:rsid="000df62c" officeooo:paragraph-rsid="000df62c" style:font-name-asian="Arial1" style:font-size-asian="14pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="14pt" style:language-complex="zxx" style:country-complex="none"/>
92
+ </style:style>
93
+ <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard">
94
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" fo:break-before="page" style:text-autospace="none"/>
95
+ <style:text-properties style:font-name="Courier New" fo:font-size="14pt" fo:language="zxx" fo:country="none" officeooo:rsid="000df62c" officeooo:paragraph-rsid="000df62c" style:font-name-asian="Arial1" style:font-size-asian="14pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial1" style:font-size-complex="14pt" style:language-complex="zxx" style:country-complex="none"/>
96
+ </style:style>
97
+ <style:style style:name="P12" style:family="paragraph" style:parent-style-name="Table_20_Contents">
98
+ <style:paragraph-properties fo:text-align="start" style:justify-single-word="false"/>
99
+ <style:text-properties style:font-name="Arial1" fo:font-size="12pt" officeooo:rsid="000bd2b4" officeooo:paragraph-rsid="000df62c" style:font-name-asian="Arial1" style:font-size-asian="12pt" style:font-name-complex="Arial1" style:font-size-complex="12pt"/>
100
+ </style:style>
101
+ <style:style style:name="Sect1" style:family="section">
102
+ <style:section-properties style:editable="false">
103
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
104
+ </style:section-properties>
105
+ </style:style>
106
+ </office:automatic-styles>
107
+ <office:body>
108
+ <office:text text:use-soft-page-breaks="true">
109
+ <text:sequence-decls>
110
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
111
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
112
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
113
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
114
+ </text:sequence-decls>
115
+ <text:p text:style-name="P10">fields_spec.rb</text:p>
116
+ <text:p text:style-name="P10"/>
117
+ <text:p text:style-name="P2"/>
118
+ <text:p text:style-name="P2">Field_01: Smitham, Veum and Funk</text:p>
119
+ <text:p text:style-name="P2">Field_02: Bert Bogan</text:p>
120
+ <text:p text:style-name="P1"/>
121
+ <text:p text:style-name="P1"/>
122
+ <table:table table:name="TABLE_01" table:style-name="TABLE_5f_01">
123
+ <table:table-column table:style-name="TABLE_5f_01.A" table:number-columns-repeated="3"/>
124
+ <table:table-row xmlns:table="table" xmlns:draw="draw" xmlns:xlink="xlink" xmlns:text="text">
125
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
126
+ <text:p text:style-name="P5">2063458380</text:p>
127
+ </table:table-cell>
128
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
129
+ <text:p text:style-name="P5">Huey Skiles</text:p>
130
+ </table:table-cell>
131
+ <table:table-cell table:style-name="TABLE_5f_01.C1" office:value-type="string">
132
+ <text:p text:style-name="P5">[COLUMN_03]</text:p>
133
+ </table:table-cell>
134
+ </table:table-row>
135
+ <table:table-row xmlns:table="table" xmlns:draw="draw" xmlns:xlink="xlink" xmlns:text="text">
136
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
137
+ <text:p text:style-name="P5">2738946152</text:p>
138
+ </table:table-cell>
139
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
140
+ <text:p text:style-name="P5">Elfriede Wyman</text:p>
141
+ </table:table-cell>
142
+ <table:table-cell table:style-name="TABLE_5f_01.C1" office:value-type="string">
143
+ <text:p text:style-name="P5">[COLUMN_03]</text:p>
144
+ </table:table-cell>
145
+ </table:table-row>
146
+ <table:table-row xmlns:table="table" xmlns:draw="draw" xmlns:xlink="xlink" xmlns:text="text">
147
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
148
+ <text:p text:style-name="P5">7700127050</text:p>
149
+ </table:table-cell>
150
+ <table:table-cell table:style-name="TABLE_5f_01.A1" office:value-type="string">
151
+ <text:p text:style-name="P5">Waldo Ebert</text:p>
152
+ </table:table-cell>
153
+ <table:table-cell table:style-name="TABLE_5f_01.C1" office:value-type="string">
154
+ <text:p text:style-name="P5">[COLUMN_03]</text:p>
155
+ </table:table-cell>
156
+ </table:table-row>
157
+ </table:table>
158
+ <text:p text:style-name="P1"/>
159
+ <text:p text:style-name="P1"/>
160
+ <text:section xmlns:draw="draw" xmlns:xlink="xlink" xmlns:text="text" text:style-name="Sect1" text:name="3944a5de-a0e4-4a00-a1d5-80e5082221f3">
161
+ <text:p text:style-name="P3">7700127050</text:p>
162
+ <text:p text:style-name="P3">Waldo Ebert</text:p>
163
+ </text:section>
164
+ <text:p text:style-name="P1"/>
165
+ <text:p text:style-name="P1"/>
166
+ <text:p text:style-name="P1"/>
167
+ <text:p text:style-name="P1"/>
168
+ <text:p text:style-name="P11">tables_spec.rb</text:p>
169
+ <text:p text:style-name="P10"/>
170
+ <text:p text:style-name="P9"/>
171
+ <table:table table:name="TABLE_02" table:style-name="TABLE_5f_02">
172
+ <table:table-column table:style-name="TABLE_5f_02.A" table:number-columns-repeated="3"/>
173
+ <table:table-row>
174
+ <table:table-cell table:style-name="TABLE_5f_02.A1" office:value-type="string">
175
+ <text:p text:style-name="P12">[COLUMN_01]</text:p>
176
+ </table:table-cell>
177
+ <table:table-cell table:style-name="TABLE_5f_02.A1" office:value-type="string">
178
+ <text:p text:style-name="P12">[COLUMN_02]</text:p>
179
+ </table:table-cell>
180
+ <table:table-cell table:style-name="TABLE_5f_02.C1" office:value-type="string">
181
+ <text:p text:style-name="P12">[COLUMN_03]</text:p>
182
+ </table:table-cell>
183
+ </table:table-row>
184
+ </table:table>
185
+ <text:p text:style-name="P7"/>
186
+ <table:table table:name="TABLE_03" table:style-name="TABLE_5f_03">
187
+ <table:table-column table:style-name="TABLE_5f_03.A" table:number-columns-repeated="3"/>
188
+ <table:table-row>
189
+ <table:table-cell table:style-name="TABLE_5f_03.A1" office:value-type="string">
190
+ <text:p text:style-name="P12">[COLUMN_01]</text:p>
191
+ </table:table-cell>
192
+ <table:table-cell table:style-name="TABLE_5f_03.A1" office:value-type="string">
193
+ <text:p text:style-name="P12">[COLUMN_02]</text:p>
194
+ </table:table-cell>
195
+ <table:table-cell table:style-name="TABLE_5f_03.C1" office:value-type="string">
196
+ <text:p text:style-name="P12">[COLUMN_03]</text:p>
197
+ </table:table-cell>
198
+ </table:table-row>
199
+ </table:table>
200
+ <text:p text:style-name="P7"/>
201
+ <text:p text:style-name="P4">END_OF_DOCUMENT</text:p>
202
+ </office:text>
203
+ </office:body>
204
+ </office:document-content>
205
+ XML
206
+
207
+ tmp = Nokogiri::XML(xml, &:noblanks)
208
+
209
+ puts tmp.at("text|section")
210
+ # tmp.root['xmlns:table'] = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"
211
+ # tmp.root['xmlns:draw'] = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
212
+ # tmp.root['xmlns:xlink'] = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
213
+ #
214
+ # # xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
215
+ #
216
+ # doc = Nokogiri::XML(tmp.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML))
217
+ #
218
+ # puts doc
219
+ #
220
+ # puts "============="
221
+ #
222
+ # nodo = doc.search("//draw:frame[@draw:name='IMAGE_IN_TABLE']/draw:image")
223
+ # puts nodo
224
+ #
225
+ # nodo.attribute('href').content = 'new_href'
226
+ #
227
+ # puts nodo
228
+ #
229
+ # puts "-------------"
230
+ #
231
+ # puts doc
232
+
233
+ # require 'ox'
234
+ #
235
+ # xml = <<-XML
236
+ # <table:table-row table:style-name="IMAGE_5f_TABLE.2">
237
+ # <table:table-cell table:style-name="IMAGE_5f_TABLE.A2" office:value-type="string">
238
+ # <text:p text:style-name="P8">[IMAGE_NAME]</text:p>
239
+ # </table:table-cell>
240
+ # <table:table-cell table:style-name="IMAGE_5f_TABLE.B2" office:value-type="string">
241
+ # <text:p text:style-name="P7">
242
+ # <draw:frame draw:style-name="fr2" draw:name="sf" text:anchor-type="paragraph" svg:width="2.5in" svg:height="1.25in" draw:z-index="2">
243
+ # <draw:image xlink:href="Pictures/C2.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" loext:mime-type="image/jpeg"/>
244
+ # </draw:frame>
245
+ # <draw:frame draw:style-name="fr2" draw:name="IMAGE_IN_TABLE" text:anchor-type="paragraph" svg:width="2.5in" svg:height="1.25in" draw:z-index="2">
246
+ # <draw:image xlink:href="Pictures/10000000000000F00000007807BDCBD66FA37CC2.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" loext:mime-type="image/jpeg"/>
247
+ # </draw:frame>
248
+ # </text:p>
249
+ # </table:table-cell>
250
+ # </table:table-row>
251
+ # XML
252
+ #
253
+ # doc = Ox.parse(xml)
254
+ #
255
+ # frame = doc.locate("*/draw:frame[@draw:name=IMAGE_IN_TABLE]")[0]
256
+ #
257
+ # img = frame.locate('*/draw:image')[0]
258
+ #
259
+ # img[:'xlink:href'] = "picture"
260
+ # frame[:'draw:name'] = "novo nome"
261
+ #
262
+ # puts Ox.dump(doc)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odf-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Duarte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-10 00:00:00.000000000 Z
11
+ date: 2020-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,17 +100,33 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.5.0
103
+ version: 1.10.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.5.0
110
+ version: 1.10.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: mime-types
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Generates ODF files, given a template (.odt) and data, replacing tags
112
126
  email: sandrods@gmail.com
113
- executables: []
127
+ executables:
128
+ - odt-extract
129
+ - odt-viewer
114
130
  extensions: []
115
131
  extra_rdoc_files: []
116
132
  files:
@@ -121,9 +137,13 @@ files:
121
137
  - Manifest
122
138
  - README.md
123
139
  - Rakefile
140
+ - bin/odt-extract
141
+ - bin/odt-viewer
124
142
  - lib/odf-report.rb
143
+ - lib/odf-report/data_source.rb
125
144
  - lib/odf-report/field.rb
126
- - lib/odf-report/images.rb
145
+ - lib/odf-report/image.rb
146
+ - lib/odf-report/nestable.rb
127
147
  - lib/odf-report/nested.rb
128
148
  - lib/odf-report/parser/default.rb
129
149
  - lib/odf-report/report.rb
@@ -134,26 +154,41 @@ files:
134
154
  - lib/odf-report/version.rb
135
155
  - odf-report.gemspec
136
156
  - spec/fields_spec.rb
137
- - spec/result/tables.rb
157
+ - spec/images/image_1.jpg
158
+ - spec/images/image_2.jpg
159
+ - spec/images/image_3.jpg
160
+ - spec/images/piriapolis.jpg
161
+ - spec/images/placeholder.jpg
162
+ - spec/images/rails.png
163
+ - spec/images_spec.rb
138
164
  - spec/spec_helper.rb
139
- - spec/specs.odt
140
165
  - spec/tables_spec.rb
141
166
  - spec/template_spec.rb
167
+ - spec/templates/images.odt
168
+ - spec/templates/specs.odt
142
169
  - test/fields_inside_text_test.rb
170
+ - test/images_test.rb
143
171
  - test/nested_tables_test.rb
144
172
  - test/sections_test.rb
145
173
  - test/sub_sections_test.rb
146
174
  - test/table_headers_test.rb
147
175
  - test/tables_test.rb
176
+ - test/templates/images/image_1.jpg
177
+ - test/templates/images/image_2.jpg
178
+ - test/templates/images/image_3.jpg
179
+ - test/templates/images/placeholder.jpg
180
+ - test/templates/images/placeholder.png
148
181
  - test/templates/piriapolis.jpg
149
182
  - test/templates/rails.png
150
183
  - test/templates/test_fields_inside_text.odt
184
+ - test/templates/test_images.odt
151
185
  - test/templates/test_nested_tables.odt
152
186
  - test/templates/test_sections.odt
153
187
  - test/templates/test_sub_sections.odt
154
188
  - test/templates/test_table_headers.odt
155
189
  - test/templates/test_tables.odt
156
190
  - test/templates/test_text.odt
191
+ - test/test.rb
157
192
  - test/text_test.rb
158
193
  homepage: http://sandrods.github.com/odf-report/
159
194
  licenses: []
@@ -173,31 +208,45 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
208
  - !ruby/object:Gem::Version
174
209
  version: '0'
175
210
  requirements: []
176
- rubyforge_project:
177
- rubygems_version: 2.6.2
211
+ rubygems_version: 3.0.3
178
212
  signing_key:
179
213
  specification_version: 4
180
214
  summary: Generates ODF files, given a template (.odt) and data, replacing tags
181
215
  test_files:
182
216
  - spec/fields_spec.rb
183
- - spec/result/tables.rb
217
+ - spec/images/image_1.jpg
218
+ - spec/images/image_2.jpg
219
+ - spec/images/image_3.jpg
220
+ - spec/images/piriapolis.jpg
221
+ - spec/images/placeholder.jpg
222
+ - spec/images/rails.png
223
+ - spec/images_spec.rb
184
224
  - spec/spec_helper.rb
185
- - spec/specs.odt
186
225
  - spec/tables_spec.rb
187
226
  - spec/template_spec.rb
227
+ - spec/templates/images.odt
228
+ - spec/templates/specs.odt
188
229
  - test/fields_inside_text_test.rb
230
+ - test/images_test.rb
189
231
  - test/nested_tables_test.rb
190
232
  - test/sections_test.rb
191
233
  - test/sub_sections_test.rb
192
234
  - test/table_headers_test.rb
193
235
  - test/tables_test.rb
236
+ - test/templates/images/image_1.jpg
237
+ - test/templates/images/image_2.jpg
238
+ - test/templates/images/image_3.jpg
239
+ - test/templates/images/placeholder.jpg
240
+ - test/templates/images/placeholder.png
194
241
  - test/templates/piriapolis.jpg
195
242
  - test/templates/rails.png
196
243
  - test/templates/test_fields_inside_text.odt
244
+ - test/templates/test_images.odt
197
245
  - test/templates/test_nested_tables.odt
198
246
  - test/templates/test_sections.odt
199
247
  - test/templates/test_sub_sections.odt
200
248
  - test/templates/test_table_headers.odt
201
249
  - test/templates/test_tables.odt
202
250
  - test/templates/test_text.odt
251
+ - test/test.rb
203
252
  - test/text_test.rb