odf-report 0.5.2 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/gem-push.yml +40 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +62 -0
  5. data/README.md +220 -0
  6. data/bin/odt-extract +10 -0
  7. data/bin/odt-viewer +18 -0
  8. data/lib/odf-report.rb +11 -8
  9. data/lib/odf-report/data_source.rb +65 -0
  10. data/lib/odf-report/field.rb +7 -40
  11. data/lib/odf-report/image.rb +57 -0
  12. data/lib/odf-report/nestable.rb +65 -0
  13. data/lib/odf-report/report.rb +24 -28
  14. data/lib/odf-report/section.rb +15 -42
  15. data/lib/odf-report/table.rb +54 -59
  16. data/lib/odf-report/template.rb +88 -0
  17. data/lib/odf-report/text.rb +1 -3
  18. data/lib/odf-report/version.rb +1 -1
  19. data/odf-report.gemspec +4 -4
  20. data/spec/fields_spec.rb +4 -4
  21. data/spec/images/image_1.jpg +0 -0
  22. data/spec/images/image_2.jpg +0 -0
  23. data/spec/images/image_3.jpg +0 -0
  24. data/spec/images/piriapolis.jpg +0 -0
  25. data/spec/images/placeholder.jpg +0 -0
  26. data/spec/images/rails.png +0 -0
  27. data/spec/images_spec.rb +159 -0
  28. data/spec/sections_spec.rb +51 -0
  29. data/spec/spec_helper.rb +2 -4
  30. data/spec/tables_spec.rb +1 -1
  31. data/spec/template_spec.rb +45 -0
  32. data/spec/templates/images.odt +0 -0
  33. data/spec/templates/specs.odt +0 -0
  34. data/test/images_test.rb +32 -0
  35. data/test/templates/images/image_1.jpg +0 -0
  36. data/test/templates/images/image_2.jpg +0 -0
  37. data/test/templates/images/image_3.jpg +0 -0
  38. data/test/templates/images/placeholder.jpg +0 -0
  39. data/test/templates/images/placeholder.png +0 -0
  40. data/test/templates/test_images.odt +0 -0
  41. data/test/test.rb +262 -0
  42. metadata +77 -23
  43. data/README.textile +0 -223
  44. data/lib/odf-report/file.rb +0 -50
  45. data/lib/odf-report/images.rb +0 -44
  46. data/lib/odf-report/nested.rb +0 -62
  47. data/spec/specs.odt +0 -0
Binary file
Binary file
@@ -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,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odf-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Duarte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,75 +84,113 @@ dependencies:
84
84
  name: rubyzip
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.2.0
89
+ version: 1.3.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.2.0
96
+ version: 1.3.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: nokogiri
99
99
  requirement: !ruby/object:Gem::Requirement
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:
133
+ - ".github/workflows/gem-push.yml"
117
134
  - ".gitignore"
118
135
  - ".rspec"
136
+ - CHANGELOG.md
119
137
  - Gemfile
120
138
  - MIT-LICENSE
121
139
  - Manifest
122
- - README.textile
140
+ - README.md
123
141
  - Rakefile
142
+ - bin/odt-extract
143
+ - bin/odt-viewer
124
144
  - lib/odf-report.rb
145
+ - lib/odf-report/data_source.rb
125
146
  - lib/odf-report/field.rb
126
- - lib/odf-report/file.rb
127
- - lib/odf-report/images.rb
128
- - lib/odf-report/nested.rb
147
+ - lib/odf-report/image.rb
148
+ - lib/odf-report/nestable.rb
129
149
  - lib/odf-report/parser/default.rb
130
150
  - lib/odf-report/report.rb
131
151
  - lib/odf-report/section.rb
132
152
  - lib/odf-report/table.rb
153
+ - lib/odf-report/template.rb
133
154
  - lib/odf-report/text.rb
134
155
  - lib/odf-report/version.rb
135
156
  - odf-report.gemspec
136
157
  - spec/fields_spec.rb
137
- - spec/result/tables.rb
158
+ - spec/images/image_1.jpg
159
+ - spec/images/image_2.jpg
160
+ - spec/images/image_3.jpg
161
+ - spec/images/piriapolis.jpg
162
+ - spec/images/placeholder.jpg
163
+ - spec/images/rails.png
164
+ - spec/images_spec.rb
165
+ - spec/sections_spec.rb
138
166
  - spec/spec_helper.rb
139
- - spec/specs.odt
140
167
  - spec/tables_spec.rb
168
+ - spec/template_spec.rb
169
+ - spec/templates/images.odt
170
+ - spec/templates/specs.odt
141
171
  - test/fields_inside_text_test.rb
172
+ - test/images_test.rb
142
173
  - test/nested_tables_test.rb
143
174
  - test/sections_test.rb
144
175
  - test/sub_sections_test.rb
145
176
  - test/table_headers_test.rb
146
177
  - test/tables_test.rb
178
+ - test/templates/images/image_1.jpg
179
+ - test/templates/images/image_2.jpg
180
+ - test/templates/images/image_3.jpg
181
+ - test/templates/images/placeholder.jpg
182
+ - test/templates/images/placeholder.png
147
183
  - test/templates/piriapolis.jpg
148
184
  - test/templates/rails.png
149
185
  - test/templates/test_fields_inside_text.odt
186
+ - test/templates/test_images.odt
150
187
  - test/templates/test_nested_tables.odt
151
188
  - test/templates/test_sections.odt
152
189
  - test/templates/test_sub_sections.odt
153
190
  - test/templates/test_table_headers.odt
154
191
  - test/templates/test_tables.odt
155
192
  - test/templates/test_text.odt
193
+ - test/test.rb
156
194
  - test/text_test.rb
157
195
  homepage: http://sandrods.github.com/odf-report/
158
196
  licenses: []
@@ -172,30 +210,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
210
  - !ruby/object:Gem::Version
173
211
  version: '0'
174
212
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.6.12
213
+ rubygems_version: 3.0.3
177
214
  signing_key:
178
215
  specification_version: 4
179
216
  summary: Generates ODF files, given a template (.odt) and data, replacing tags
180
217
  test_files:
181
218
  - spec/fields_spec.rb
182
- - spec/result/tables.rb
219
+ - spec/images/image_1.jpg
220
+ - spec/images/image_2.jpg
221
+ - spec/images/image_3.jpg
222
+ - spec/images/piriapolis.jpg
223
+ - spec/images/placeholder.jpg
224
+ - spec/images/rails.png
225
+ - spec/images_spec.rb
226
+ - spec/sections_spec.rb
183
227
  - spec/spec_helper.rb
184
- - spec/specs.odt
185
228
  - spec/tables_spec.rb
229
+ - spec/template_spec.rb
230
+ - spec/templates/images.odt
231
+ - spec/templates/specs.odt
186
232
  - test/fields_inside_text_test.rb
233
+ - test/images_test.rb
187
234
  - test/nested_tables_test.rb
188
235
  - test/sections_test.rb
189
236
  - test/sub_sections_test.rb
190
237
  - test/table_headers_test.rb
191
238
  - test/tables_test.rb
239
+ - test/templates/images/image_1.jpg
240
+ - test/templates/images/image_2.jpg
241
+ - test/templates/images/image_3.jpg
242
+ - test/templates/images/placeholder.jpg
243
+ - test/templates/images/placeholder.png
192
244
  - test/templates/piriapolis.jpg
193
245
  - test/templates/rails.png
194
246
  - test/templates/test_fields_inside_text.odt
247
+ - test/templates/test_images.odt
195
248
  - test/templates/test_nested_tables.odt
196
249
  - test/templates/test_sections.odt
197
250
  - test/templates/test_sub_sections.odt
198
251
  - test/templates/test_table_headers.odt
199
252
  - test/templates/test_tables.odt
200
253
  - test/templates/test_text.odt
254
+ - test/test.rb
201
255
  - test/text_test.rb