caracal 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +941 -0
- data/Rakefile +2 -0
- data/caracal.gemspec +27 -0
- data/lib/caracal.rb +31 -0
- data/lib/caracal/core/file_name.rb +39 -0
- data/lib/caracal/core/fonts.rb +75 -0
- data/lib/caracal/core/images.rb +37 -0
- data/lib/caracal/core/line_breaks.rb +29 -0
- data/lib/caracal/core/list_styles.rb +92 -0
- data/lib/caracal/core/lists.rb +57 -0
- data/lib/caracal/core/models/base_model.rb +51 -0
- data/lib/caracal/core/models/border_model.rb +120 -0
- data/lib/caracal/core/models/font_model.rb +64 -0
- data/lib/caracal/core/models/image_model.rb +118 -0
- data/lib/caracal/core/models/line_break_model.rb +15 -0
- data/lib/caracal/core/models/link_model.rb +65 -0
- data/lib/caracal/core/models/list_item_model.rb +105 -0
- data/lib/caracal/core/models/list_model.rb +130 -0
- data/lib/caracal/core/models/list_style_model.rb +129 -0
- data/lib/caracal/core/models/margin_model.rb +76 -0
- data/lib/caracal/core/models/page_break_model.rb +15 -0
- data/lib/caracal/core/models/page_number_model.rb +69 -0
- data/lib/caracal/core/models/page_size_model.rb +70 -0
- data/lib/caracal/core/models/paragraph_model.rb +141 -0
- data/lib/caracal/core/models/relationship_model.rb +108 -0
- data/lib/caracal/core/models/rule_model.rb +27 -0
- data/lib/caracal/core/models/style_model.rb +134 -0
- data/lib/caracal/core/models/table_cell_model.rb +155 -0
- data/lib/caracal/core/models/table_model.rb +206 -0
- data/lib/caracal/core/models/text_model.rb +92 -0
- data/lib/caracal/core/page_breaks.rb +29 -0
- data/lib/caracal/core/page_numbers.rb +51 -0
- data/lib/caracal/core/page_settings.rb +72 -0
- data/lib/caracal/core/relationships.rb +90 -0
- data/lib/caracal/core/rules.rb +35 -0
- data/lib/caracal/core/styles.rb +86 -0
- data/lib/caracal/core/tables.rb +41 -0
- data/lib/caracal/core/text.rb +73 -0
- data/lib/caracal/document.rb +242 -0
- data/lib/caracal/errors.rb +23 -0
- data/lib/caracal/renderers/app_renderer.rb +41 -0
- data/lib/caracal/renderers/content_types_renderer.rb +53 -0
- data/lib/caracal/renderers/core_renderer.rb +44 -0
- data/lib/caracal/renderers/document_renderer.rb +349 -0
- data/lib/caracal/renderers/fonts_renderer.rb +56 -0
- data/lib/caracal/renderers/footer_renderer.rb +69 -0
- data/lib/caracal/renderers/numbering_renderer.rb +87 -0
- data/lib/caracal/renderers/package_relationships_renderer.rb +50 -0
- data/lib/caracal/renderers/relationships_renderer.rb +48 -0
- data/lib/caracal/renderers/settings_renderer.rb +58 -0
- data/lib/caracal/renderers/styles_renderer.rb +163 -0
- data/lib/caracal/renderers/xml_renderer.rb +83 -0
- data/lib/caracal/version.rb +3 -0
- data/lib/tilt/caracal.rb +21 -0
- data/spec/lib/caracal/core/file_name_spec.rb +54 -0
- data/spec/lib/caracal/core/fonts_spec.rb +119 -0
- data/spec/lib/caracal/core/images_spec.rb +25 -0
- data/spec/lib/caracal/core/line_breaks_spec.rb +25 -0
- data/spec/lib/caracal/core/list_styles_spec.rb +121 -0
- data/spec/lib/caracal/core/lists_spec.rb +43 -0
- data/spec/lib/caracal/core/models/base_model_spec.rb +38 -0
- data/spec/lib/caracal/core/models/border_model_spec.rb +159 -0
- data/spec/lib/caracal/core/models/font_model_spec.rb +92 -0
- data/spec/lib/caracal/core/models/image_model_spec.rb +192 -0
- data/spec/lib/caracal/core/models/line_break_model_spec.rb +21 -0
- data/spec/lib/caracal/core/models/link_model_spec.rb +139 -0
- data/spec/lib/caracal/core/models/list_item_model_spec.rb +190 -0
- data/spec/lib/caracal/core/models/list_model_spec.rb +178 -0
- data/spec/lib/caracal/core/models/list_style_model_spec.rb +212 -0
- data/spec/lib/caracal/core/models/margin_model_spec.rb +111 -0
- data/spec/lib/caracal/core/models/page_break_model_spec.rb +21 -0
- data/spec/lib/caracal/core/models/page_number_model_spec.rb +101 -0
- data/spec/lib/caracal/core/models/page_size_model_spec.rb +91 -0
- data/spec/lib/caracal/core/models/paragraph_model_spec.rb +162 -0
- data/spec/lib/caracal/core/models/relationship_model_spec.rb +183 -0
- data/spec/lib/caracal/core/models/rule_model_spec.rb +108 -0
- data/spec/lib/caracal/core/models/style_model_spec.rb +187 -0
- data/spec/lib/caracal/core/models/table_cell_model_spec.rb +221 -0
- data/spec/lib/caracal/core/models/table_model_spec.rb +222 -0
- data/spec/lib/caracal/core/models/text_model_spec.rb +132 -0
- data/spec/lib/caracal/core/page_breaks_spec.rb +25 -0
- data/spec/lib/caracal/core/page_numbers_spec.rb +80 -0
- data/spec/lib/caracal/core/page_settings_spec.rb +143 -0
- data/spec/lib/caracal/core/relationships_spec.rb +119 -0
- data/spec/lib/caracal/core/rules_spec.rb +25 -0
- data/spec/lib/caracal/core/styles_spec.rb +129 -0
- data/spec/lib/caracal/core/tables_spec.rb +25 -0
- data/spec/lib/caracal/core/text_spec.rb +52 -0
- data/spec/lib/caracal/errors_spec.rb +10 -0
- data/spec/spec_helper.rb +8 -0
- metadata +245 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 81137b2dc72712fd3c5c95ab50d891c9a00a8d48
|
|
4
|
+
data.tar.gz: 1d1759101762572d0582c0146a04de5ccdbd456b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b9ddda6ff2016be507bb7156ad3743954df7c0c20f8bccf5d49014505a9d3599229c82b19cbfc1ee0d782b10ab8c8429807e228c1d7a05f0bb5b7426eaa7a548
|
|
7
|
+
data.tar.gz: 90244ef8ea1e5946ba5e04c496c583571894193e26cde5251a17da37b9033a579d1f6acbed57e40e15048f09f823161ae689fa8ac1710132eb41d83a6aa526a7
|
data/.gitignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
|
23
|
+
gemfiles/*.gemfile.lock
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Trade Informatics, Inc.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
# Caracal
|
|
2
|
+
|
|
3
|
+
Caracal is a ruby library for dynamically creating professional-quality Microsoft Word documents (.docx) using an HTML-style syntax.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
gem 'caracal'
|
|
11
|
+
|
|
12
|
+
Then execute:
|
|
13
|
+
|
|
14
|
+
$ bundle install
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Many people don't know that .docx files are little more than a zipped collection of XML documents that follow the OfficeOpen XML (OpenXML or OOXML) standard. This means constructing a .docx file from scratch actually requires the creation of several files. Caracal abstracts users from this process by providing a simple set of Ruby commands and HTML-style syntax for generating Word content.
|
|
20
|
+
|
|
21
|
+
For each Caracal request, the following document structure will be created and zipped into the final output file:
|
|
22
|
+
|
|
23
|
+
example.docx
|
|
24
|
+
|- _rels
|
|
25
|
+
|- docProps
|
|
26
|
+
|- app.xml
|
|
27
|
+
|- core.xml
|
|
28
|
+
|- word
|
|
29
|
+
|- _rels
|
|
30
|
+
|- document.xml.rels
|
|
31
|
+
|- media
|
|
32
|
+
|- image001.png
|
|
33
|
+
|- image002.png
|
|
34
|
+
...
|
|
35
|
+
|- document.xml
|
|
36
|
+
|- fontTable.xml
|
|
37
|
+
|- footer.xml
|
|
38
|
+
|- numbering.xml
|
|
39
|
+
|- settings.xml
|
|
40
|
+
|- styles.xml
|
|
41
|
+
|- [Content_Types].xml
|
|
42
|
+
|
|
43
|
+
### File Descriptions
|
|
44
|
+
|
|
45
|
+
The following provides a brief description for each component of the final document:
|
|
46
|
+
|
|
47
|
+
**_rels/.rels**
|
|
48
|
+
Defines an internal identifier and type for global content items. *This file is generated automatically by the library based on other user directives.*
|
|
49
|
+
|
|
50
|
+
**docProps/app.xml**
|
|
51
|
+
Specifies the name of the application that generated the document. *This file is generated automatically by the library based on other user directives.*
|
|
52
|
+
|
|
53
|
+
**docProps/core.xml**
|
|
54
|
+
Specifies the title of the document. *This file is generated automatically by the library based on other user directives.*
|
|
55
|
+
|
|
56
|
+
**word/_rels/document.xml.rels**
|
|
57
|
+
Defines an internal identifier and type with all external content items (images, links, etc). *This file is generated automatically by the library based on other user directives.*
|
|
58
|
+
|
|
59
|
+
**word/media/**
|
|
60
|
+
A collection of media assets (each of which should have an entry in document.xml.rels).
|
|
61
|
+
|
|
62
|
+
**word/document.xml**
|
|
63
|
+
The main content file for the document.
|
|
64
|
+
|
|
65
|
+
**word/fontTable.xml**
|
|
66
|
+
Specifies the fonts used in the document.
|
|
67
|
+
|
|
68
|
+
**word/footer.xml**
|
|
69
|
+
Defines the formatting of the document footer.
|
|
70
|
+
|
|
71
|
+
**word/numbering.xml**
|
|
72
|
+
Defines ordered and unordered list styles.
|
|
73
|
+
|
|
74
|
+
**word/settings.xml**
|
|
75
|
+
Defines global directives for the document (e.g., whether to show background images, tab widths, etc). Also, establishes compatibility with older versions on Word.
|
|
76
|
+
|
|
77
|
+
**word/styles.xml**
|
|
78
|
+
Defines all paragraph and table styles used through the document. Caracal adds a default set of styles to match its HTML-like content syntax. These defaults can be overridden.
|
|
79
|
+
|
|
80
|
+
**[Content_Types].xml**
|
|
81
|
+
Pairs extensions and XML files with schema content types so Word can parse them correctly. *This file is generated automatically by the library based on other user directives.*
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Units
|
|
85
|
+
|
|
86
|
+
OpenXML uses a few basic units.
|
|
87
|
+
|
|
88
|
+
**Points**
|
|
89
|
+
Most spacing declarations are measured in full points.
|
|
90
|
+
|
|
91
|
+
**Half Points**
|
|
92
|
+
All font sizes are measure in half points. A font size of 24 is equivalent to 12pt.
|
|
93
|
+
|
|
94
|
+
**Eighth Points**
|
|
95
|
+
Borders are measured in 1/8 points. A border size of 4 is equivalent to 0.5pt.
|
|
96
|
+
|
|
97
|
+
**Twips**
|
|
98
|
+
A twip is 1/20 of a point. Word documents are printed at 72dpi. 1in == 72pt == 1440 twips.
|
|
99
|
+
|
|
100
|
+
**Pixels**
|
|
101
|
+
In Word documents, pixels are equivalent to points.
|
|
102
|
+
|
|
103
|
+
**EMUs (English Metric Unit)**
|
|
104
|
+
EMUs are a virtual unit designed to facilitate the smooth conversion between inches, milliimeters, and pixels for images and vector graphics. 1in == 914400 EMUs == 72dpi x 100 x 254.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Syntax
|
|
108
|
+
|
|
109
|
+
In the following examples, the variable `docx` is assumed to be an instance of Caracal::Document.
|
|
110
|
+
|
|
111
|
+
docx = Caracal::Document.new('example_document.docx')
|
|
112
|
+
|
|
113
|
+
### File Name
|
|
114
|
+
|
|
115
|
+
The final output document's title can be set at initialization or via the `file_name` method.
|
|
116
|
+
|
|
117
|
+
docx = Caracal::Document.new('example_document.docx')
|
|
118
|
+
|
|
119
|
+
docx.file_name 'example_document.docx'
|
|
120
|
+
|
|
121
|
+
The current document name can be returned by invoking the `name` method:
|
|
122
|
+
|
|
123
|
+
docx.name # => 'example_document.docx'
|
|
124
|
+
|
|
125
|
+
*The default file name is caracal.docx.*
|
|
126
|
+
|
|
127
|
+
### Page Size
|
|
128
|
+
|
|
129
|
+
Page dimensions can be set using the `page_size` method. The method accepts two parameters for controlling the width and height of the document.
|
|
130
|
+
|
|
131
|
+
*Pages default to the United States standard A4, portrait dimensions (8.5in x 11in).*
|
|
132
|
+
|
|
133
|
+
# options via block
|
|
134
|
+
docx.page_size do
|
|
135
|
+
width 12240 # sets the page width. units in twips.
|
|
136
|
+
height 15840 # sets the page height. units in twips.
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# options via hash
|
|
140
|
+
docx.page_size width: 12240, height: 15840
|
|
141
|
+
|
|
142
|
+
The `page_size` command will produce the following XML in the `document.xml` file:
|
|
143
|
+
|
|
144
|
+
<w:sectPr>
|
|
145
|
+
<w:pgSz w:w="12240" w:h="15840"/>
|
|
146
|
+
</w:sectPr>
|
|
147
|
+
|
|
148
|
+
### Page Margins
|
|
149
|
+
|
|
150
|
+
Page margins can be set using the `page_margins` method. The method accepts four parameters for controlling the margins of the document.
|
|
151
|
+
*Margins default to 1.0in for all sides.*
|
|
152
|
+
|
|
153
|
+
# options via block
|
|
154
|
+
docx.page_margins do
|
|
155
|
+
left 720 # sets the left margin. units in twips.
|
|
156
|
+
right 720 # sets the right margin. units in twips.
|
|
157
|
+
top 1440 # sets the top margin. units in twips.
|
|
158
|
+
bottom 1440 # sets the bottom margin. units in twips.
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# options via hash
|
|
162
|
+
docx.page_margins left: 720, right: 720, top: 1440, bottom: 1440
|
|
163
|
+
|
|
164
|
+
The `page_margins` command above will produce the following XML in the `document.xml` file:
|
|
165
|
+
|
|
166
|
+
<w:sectPr>
|
|
167
|
+
<w:pgMar w:left="720" w:right="720" w:top="1440" w:bottom="1440"/>
|
|
168
|
+
</w:sectPr>
|
|
169
|
+
|
|
170
|
+
### Page Breaks
|
|
171
|
+
|
|
172
|
+
Page breaks can be added via the `page` method. The method accepts no parameters.
|
|
173
|
+
|
|
174
|
+
docx.page # starts a new page.
|
|
175
|
+
|
|
176
|
+
The `page` command will produce the following XML in the `document.xml` file:
|
|
177
|
+
|
|
178
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
179
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
180
|
+
<w:br w:type="page"/>
|
|
181
|
+
</w:r>
|
|
182
|
+
</w:p>
|
|
183
|
+
|
|
184
|
+
### Page Numbers
|
|
185
|
+
|
|
186
|
+
Page numbers can be added to the footer via the `page_numbers` method. The method accepts an optional parameter for controlling the alignment of the text.
|
|
187
|
+
|
|
188
|
+
*Page numbers are turned off by default.*
|
|
189
|
+
|
|
190
|
+
# no options
|
|
191
|
+
docx.page_numbers true
|
|
192
|
+
|
|
193
|
+
# options via block
|
|
194
|
+
docx.page_numbers true do
|
|
195
|
+
align :right # controls text alignment. defaults to :center.
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# options via hash
|
|
199
|
+
docx.page_numbers true, align: :right
|
|
200
|
+
|
|
201
|
+
The default command will produce the following `footer.xml` file contents.
|
|
202
|
+
|
|
203
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
204
|
+
<w:ftr xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:lc="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram">
|
|
205
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
206
|
+
<w:pPr>
|
|
207
|
+
<w:contextualSpacing w:val="0"/>
|
|
208
|
+
<w:jc w:val="center"/>
|
|
209
|
+
</w:pPr>
|
|
210
|
+
<w:fldSimple w:dirty="0" w:instr="PAGE" w:fldLock="0">
|
|
211
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
212
|
+
<w:rPr/>
|
|
213
|
+
</w:r>
|
|
214
|
+
</w:fldSimple>
|
|
215
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
216
|
+
<w:rPr>
|
|
217
|
+
<w:rtl w:val="0"/>
|
|
218
|
+
</w:rPr>
|
|
219
|
+
</w:r>
|
|
220
|
+
</w:p>
|
|
221
|
+
</w:ftr>
|
|
222
|
+
|
|
223
|
+
*It will also automatically add the correct notation to the `w:sectPr` node of the `document.xml` file.*
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
### Fonts
|
|
227
|
+
|
|
228
|
+
Fonts are added to the font table file by calling the `font` method and passing the name of the font. At present, Caracal only supports declaring the primary font name.
|
|
229
|
+
|
|
230
|
+
docx.font name: 'Arial'
|
|
231
|
+
docx.font do
|
|
232
|
+
name 'Droid Serif'
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
These commands will produce the following `fontTable.xml` file contents:
|
|
236
|
+
|
|
237
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
238
|
+
<w:fonts xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:lc="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram">
|
|
239
|
+
<w:font w:name="Arial"/>
|
|
240
|
+
<w:font w:name="Droid Serif"/>
|
|
241
|
+
</w:fonts>
|
|
242
|
+
|
|
243
|
+
### Styles
|
|
244
|
+
|
|
245
|
+
Style classes can be added using the `style` method. The method accepts several optional parameters to control the rendering of text using the style.
|
|
246
|
+
|
|
247
|
+
# options via block
|
|
248
|
+
docx.style do
|
|
249
|
+
type :paragraph # :paragraph or :table
|
|
250
|
+
id 'Heading1' # sets the internal identifier for the style.
|
|
251
|
+
name 'heading 1' # set the friendly name of the style.
|
|
252
|
+
color '333333' # sets the text color. values in hex RGB.
|
|
253
|
+
font 'Droid Serif' # sets the font family.
|
|
254
|
+
size 28 # set the font size. units in half points.
|
|
255
|
+
bold false # sets the font weight.
|
|
256
|
+
italic false # sets the font style.
|
|
257
|
+
underline false # sets whether or not to underline the text.
|
|
258
|
+
align :left # sets the alignment. accepts :left, :center, :right, and :both.
|
|
259
|
+
top 100 # sets the spacing above the paragraph. units in twips.
|
|
260
|
+
bottom 0 # sets the spacing below the paragraph. units in twips.
|
|
261
|
+
spacing 360 # sets the spacing between lines. units in twips.
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
The `style` command above would produce the following XML:
|
|
265
|
+
|
|
266
|
+
<w:style w:styleId="Heading1" w:type="paragraph">
|
|
267
|
+
<w:name w:val="heading 1"/>
|
|
268
|
+
<w:basedOn w:val="Normal"/>
|
|
269
|
+
<w:next w:val="Normal"/>
|
|
270
|
+
<w:pPr>
|
|
271
|
+
<w:keepNext w:val="0"/>
|
|
272
|
+
<w:keepLines w:val="0"/>
|
|
273
|
+
<w:widowControl w:val="0"/>
|
|
274
|
+
<w:contextualSpacing w:val="1"/>
|
|
275
|
+
</w:pPr>
|
|
276
|
+
<w:rPr>
|
|
277
|
+
<w:rFonts w:cs="Droid Serif" w:hAnsi="Droid Serif" w:eastAsia="Droid Serif" w:ascii="Droid Serif"/>
|
|
278
|
+
<w:sz w:val="28"/>
|
|
279
|
+
</w:rPr>
|
|
280
|
+
</w:style>
|
|
281
|
+
|
|
282
|
+
### Paragraphs
|
|
283
|
+
|
|
284
|
+
Text can be added using the `p` method. The `p` either takes a string and a `class` option or a block of `text`-like commands.
|
|
285
|
+
|
|
286
|
+
Text within a `p` block can be further defined using the `text` and `link` methods. The `text` method takes a text string and the optional parameters `style`, `color`, `size`, `bold`, `italic`, and `underline`. See below for details on the `link` method.
|
|
287
|
+
|
|
288
|
+
docx.p 'some text', style: 'my_style'
|
|
289
|
+
|
|
290
|
+
docx.p do
|
|
291
|
+
text 'Here is a sentence with a ', style: 'my_style'
|
|
292
|
+
link 'link', 'https://www.example.com'
|
|
293
|
+
text ' to something awesome', color: '555555', size: 16, bold: true, italic: true, underline: true
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
A `p` block might yield the following XML:
|
|
298
|
+
|
|
299
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
300
|
+
<w:pPr>
|
|
301
|
+
<w:contextualSpacing w:val="0"/>
|
|
302
|
+
</w:pPr>
|
|
303
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
304
|
+
<w:rPr>
|
|
305
|
+
<w:rtl w:val="0"/>
|
|
306
|
+
</w:rPr>
|
|
307
|
+
<w:t xml:space="preserve">Here is a sentence with a </w:t>
|
|
308
|
+
</w:r>
|
|
309
|
+
<w:hyperlink r:id="rId6">
|
|
310
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
311
|
+
<w:rPr>
|
|
312
|
+
<w:color w:val="1155cc"/>
|
|
313
|
+
<w:u w:val="single"/>
|
|
314
|
+
<w:rtl w:val="0"/>
|
|
315
|
+
</w:rPr>
|
|
316
|
+
<w:t xml:space="preserve">link</w:t>
|
|
317
|
+
</w:r>
|
|
318
|
+
</w:hyperlink>
|
|
319
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
320
|
+
<w:rPr>
|
|
321
|
+
<w:b w:val="1"/>
|
|
322
|
+
<w:rtl w:val="0"/>
|
|
323
|
+
</w:rPr>
|
|
324
|
+
<w:t xml:space="preserve"> to something awesome.</w:t>
|
|
325
|
+
</w:r>
|
|
326
|
+
</w:p>
|
|
327
|
+
|
|
328
|
+
### Headers
|
|
329
|
+
|
|
330
|
+
Headers can be added using the `h1`, `h2`, etc. methods. Text within a header block can be further defined using the `text` method.
|
|
331
|
+
|
|
332
|
+
*Ultimately, headers are just paragraphs that use header styles.*
|
|
333
|
+
|
|
334
|
+
docx.h3 'Heading 3'
|
|
335
|
+
|
|
336
|
+
The `h3` block above will yield the following XML:
|
|
337
|
+
|
|
338
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
339
|
+
<w:pPr>
|
|
340
|
+
<w:pStyle w:val="Heading3"/>
|
|
341
|
+
<w:contextualSpacing w:val="0"/>
|
|
342
|
+
</w:pPr>
|
|
343
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
344
|
+
<w:rPr>
|
|
345
|
+
<w:rtl w:val="0"/>
|
|
346
|
+
</w:rPr>
|
|
347
|
+
<w:t xml:space="preserve">Heading 3</w:t>
|
|
348
|
+
</w:r>
|
|
349
|
+
</w:p>
|
|
350
|
+
|
|
351
|
+
### Links
|
|
352
|
+
|
|
353
|
+
Links can be added inside paragraphs by using the `link` method. The method accepts several optional parameters for controlling the style and behavior of the rule.
|
|
354
|
+
|
|
355
|
+
*At present, all links are assumed to be external.*
|
|
356
|
+
|
|
357
|
+
# no options
|
|
358
|
+
docx.p do
|
|
359
|
+
link 'Example Text', 'https://wwww.example.com'
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# options via block
|
|
363
|
+
p do
|
|
364
|
+
link 'Example Text', 'https://wwww.example.com' do
|
|
365
|
+
style 'my_style' # sets the style class. defaults to nil.
|
|
366
|
+
color '0000ff' # sets the color of the text. defaults to 1155cc.
|
|
367
|
+
size 24 # sets the font size. units in half-points. defaults to nil.
|
|
368
|
+
bold false # sets whether or not the text will be bold. defaults to false.
|
|
369
|
+
italic false # sets whether or not the text will be italic. defaults to false.
|
|
370
|
+
underline true # sets whether or not the text will be underlined. defaults to true.
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# options via hash
|
|
375
|
+
p do
|
|
376
|
+
link 'Example Text', 'https://wwww.example.com', color: '0000ff', underline: false
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
The `link` command with default properties will produce the following XML output:
|
|
380
|
+
|
|
381
|
+
<w:hyperlink r:id="rId1">
|
|
382
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
383
|
+
<w:rPr>
|
|
384
|
+
<w:color w:val="1155cc"/>
|
|
385
|
+
<w:u w:val="single"/>
|
|
386
|
+
<w:rtl w:val="0"/>
|
|
387
|
+
</w:rPr>
|
|
388
|
+
<w:t xml:space="preserve">Example Text</w:t>
|
|
389
|
+
</w:r>
|
|
390
|
+
</w:hyperlink>
|
|
391
|
+
|
|
392
|
+
*Caracal will automatically generate the relationship entries required by the OpenXML standard.*
|
|
393
|
+
|
|
394
|
+
<Relationship Target="https://www.example.com" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" TargetMode="External" Id="rId1"/>
|
|
395
|
+
|
|
396
|
+
### Images
|
|
397
|
+
|
|
398
|
+
Images can be added by using the `img` method. The method accepts several optional parameters for controlling the style and placement of the asset.
|
|
399
|
+
|
|
400
|
+
# options via block
|
|
401
|
+
docx.img image_url('example.png') do
|
|
402
|
+
width 396 # sets the image width. units specified in pixels.
|
|
403
|
+
height 216 # sets the image height. units specified in pixels.
|
|
404
|
+
align :right # controls the justification of the image. default is :left.
|
|
405
|
+
top 10 # sets the top margin. units specified in pixels.
|
|
406
|
+
bottom 10 # sets the bottom margin. units specified in pixels.
|
|
407
|
+
left 10 # sets the left margin. units specified in pixels.
|
|
408
|
+
right 10 # sets the right margin. units specified in pixels.
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# options via hash
|
|
412
|
+
docx.img image_url('example.png'), width: 396, height: 216, align: :right
|
|
413
|
+
|
|
414
|
+
The `img` command with default properties will produce the following XML output:
|
|
415
|
+
|
|
416
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
417
|
+
<w:pPr>
|
|
418
|
+
<w:spacing w:lineRule="auto" w:line="276"/>
|
|
419
|
+
<w:contextualSpacing w:val="0"/>
|
|
420
|
+
<w:jc w:val="right"/>
|
|
421
|
+
<w:rPr/>
|
|
422
|
+
</w:pPr>
|
|
423
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
424
|
+
<w:drawing>
|
|
425
|
+
<wp:inline distR="114300" distT="114300" distB="114300" distL="114300">
|
|
426
|
+
<wp:extent cy="2743200" cx="5029200"/>
|
|
427
|
+
<wp:effectExtent t="0" b="0" r="0" l="0"/>
|
|
428
|
+
<wp:docPr id="1" name="image00.png"/>
|
|
429
|
+
<a:graphic>
|
|
430
|
+
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
|
|
431
|
+
<pic:pic>
|
|
432
|
+
<pic:nvPicPr>
|
|
433
|
+
<pic:cNvPr id="0" name="image00.png"/>
|
|
434
|
+
<pic:cNvPicPr preferRelativeResize="0"/>
|
|
435
|
+
</pic:nvPicPr>
|
|
436
|
+
<pic:blipFill>
|
|
437
|
+
<a:blip r:embed="rId5"/>
|
|
438
|
+
<a:srcRect t="0" b="0" r="0" l="0"/>
|
|
439
|
+
<a:stretch>
|
|
440
|
+
<a:fillRect/>
|
|
441
|
+
</a:stretch>
|
|
442
|
+
</pic:blipFill>
|
|
443
|
+
<pic:spPr>
|
|
444
|
+
<a:xfrm>
|
|
445
|
+
<a:ext cy="2743200" cx="5029200"/>
|
|
446
|
+
</a:xfrm>
|
|
447
|
+
<a:prstGeom prst="rect"/>
|
|
448
|
+
<a:ln/>
|
|
449
|
+
</pic:spPr>
|
|
450
|
+
</pic:pic>
|
|
451
|
+
</a:graphicData>
|
|
452
|
+
</a:graphic>
|
|
453
|
+
</wp:inline>
|
|
454
|
+
</w:drawing>
|
|
455
|
+
</w:r>
|
|
456
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
457
|
+
<w:rPr>
|
|
458
|
+
<w:rtl w:val="0"/>
|
|
459
|
+
</w:rPr>
|
|
460
|
+
</w:r>
|
|
461
|
+
</w:p>
|
|
462
|
+
|
|
463
|
+
*Caracal will automatically generate the relationship entries required by the OpenXML standard.*
|
|
464
|
+
|
|
465
|
+
<Relationship Target="media/image00.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId5"/>
|
|
466
|
+
|
|
467
|
+
### Rules
|
|
468
|
+
|
|
469
|
+
Horizontal rules can be added using the `hr` method. The method accepts several optional parameters for controlling the style of the rule.
|
|
470
|
+
|
|
471
|
+
# no options
|
|
472
|
+
docx.hr # defaults to a thin, single line.
|
|
473
|
+
|
|
474
|
+
# options via block
|
|
475
|
+
docx.hr do
|
|
476
|
+
color '333333' # controls the color of the line. defaults to auto.
|
|
477
|
+
line :double # controls the line style (single or double). defaults to single.
|
|
478
|
+
size 8 # controls the thickness of the line. units in 1/8 points. defaults to 4.
|
|
479
|
+
spacing 4 # controls the spacing around the line. units in points. defaults to 1.
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# options via hash
|
|
483
|
+
docx.hr color: '333333', line: :double, size: 8, spacing: 2
|
|
484
|
+
|
|
485
|
+
The `hr` command with default properties will produce the following XML output:
|
|
486
|
+
|
|
487
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
488
|
+
<w:pPr>
|
|
489
|
+
<w:pBdr>
|
|
490
|
+
<w:top w:color="auto" w:space="1" w:val="single" w:sz="4"/>
|
|
491
|
+
</w:pBdr>
|
|
492
|
+
</w:pPr>
|
|
493
|
+
</w:p>
|
|
494
|
+
|
|
495
|
+
### Ordered Lists
|
|
496
|
+
|
|
497
|
+
Ordered lists can be added using the `ol` and `li` methods. The `li` method substantially follows the same rules as the the `p` method; here, simpler examples are demonstrated.
|
|
498
|
+
|
|
499
|
+
docx.ol do
|
|
500
|
+
li 'First item'
|
|
501
|
+
li 'Second item'
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
The `ol` and `li` commands with default properties will produce the following XML (assuming the ordered list styles have the abstractNumId=2 in the `numbering.xml` file).
|
|
505
|
+
|
|
506
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
507
|
+
<w:pPr>
|
|
508
|
+
<w:numPr>
|
|
509
|
+
<w:ilvl w:val="0"/>
|
|
510
|
+
<w:numId w:val="2"/>
|
|
511
|
+
</w:numPr>
|
|
512
|
+
<w:ind w:left="720" w:hanging="359"/>
|
|
513
|
+
<w:contextualSpacing w:val="1"/>
|
|
514
|
+
<w:rPr>
|
|
515
|
+
<w:u w:val="none"/>
|
|
516
|
+
</w:rPr>
|
|
517
|
+
</w:pPr>
|
|
518
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
519
|
+
<w:rPr>
|
|
520
|
+
<w:rtl w:val="0"/>
|
|
521
|
+
</w:rPr>
|
|
522
|
+
<w:t xml:space="preserve">First item</w:t>
|
|
523
|
+
</w:r>
|
|
524
|
+
</w:p>
|
|
525
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
526
|
+
<w:pPr>
|
|
527
|
+
<w:numPr>
|
|
528
|
+
<w:ilvl w:val="0"/>
|
|
529
|
+
<w:numId w:val="2"/>
|
|
530
|
+
</w:numPr>
|
|
531
|
+
<w:ind w:left="720" w:hanging="359"/>
|
|
532
|
+
<w:contextualSpacing w:val="1"/>
|
|
533
|
+
<w:rPr>
|
|
534
|
+
<w:u w:val="none"/>
|
|
535
|
+
</w:rPr>
|
|
536
|
+
</w:pPr>
|
|
537
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
538
|
+
<w:rPr>
|
|
539
|
+
<w:rtl w:val="0"/>
|
|
540
|
+
</w:rPr>
|
|
541
|
+
<w:t xml:space="preserve">Second item</w:t>
|
|
542
|
+
</w:r>
|
|
543
|
+
</w:p>
|
|
544
|
+
|
|
545
|
+
### Unordered Lists
|
|
546
|
+
|
|
547
|
+
Unordered lists can be added using the `ul` and `li` methods. The `li` method substantially follows the same rules as the the `p` method; here, simpler examples are demonstrated.
|
|
548
|
+
|
|
549
|
+
docx.ul do
|
|
550
|
+
li 'First item'
|
|
551
|
+
li 'Second item'
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
The `ul` and `li` commands with default properties will produce the following XML (assuming the ordered list styles have the abstractNumId=1 in the `numbering.xml` file).
|
|
555
|
+
|
|
556
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
557
|
+
<w:pPr>
|
|
558
|
+
<w:numPr>
|
|
559
|
+
<w:ilvl w:val="0"/>
|
|
560
|
+
<w:numId w:val="1"/>
|
|
561
|
+
</w:numPr>
|
|
562
|
+
<w:ind w:left="720" w:hanging="359"/>
|
|
563
|
+
<w:contextualSpacing w:val="1"/>
|
|
564
|
+
<w:rPr>
|
|
565
|
+
<w:u w:val="none"/>
|
|
566
|
+
</w:rPr>
|
|
567
|
+
</w:pPr>
|
|
568
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
569
|
+
<w:rPr>
|
|
570
|
+
<w:rtl w:val="0"/>
|
|
571
|
+
</w:rPr>
|
|
572
|
+
<w:t xml:space="preserve">First item</w:t>
|
|
573
|
+
</w:r>
|
|
574
|
+
</w:p>
|
|
575
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
576
|
+
<w:pPr>
|
|
577
|
+
<w:numPr>
|
|
578
|
+
<w:ilvl w:val="0"/>
|
|
579
|
+
<w:numId w:val="1"/>
|
|
580
|
+
</w:numPr>
|
|
581
|
+
<w:ind w:left="720" w:hanging="359"/>
|
|
582
|
+
<w:contextualSpacing w:val="1"/>
|
|
583
|
+
<w:rPr>
|
|
584
|
+
<w:u w:val="none"/>
|
|
585
|
+
</w:rPr>
|
|
586
|
+
</w:pPr>
|
|
587
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
588
|
+
<w:rPr>
|
|
589
|
+
<w:rtl w:val="0"/>
|
|
590
|
+
</w:rPr>
|
|
591
|
+
<w:t xml:space="preserve">Second item</w:t>
|
|
592
|
+
</w:r>
|
|
593
|
+
</w:p>
|
|
594
|
+
|
|
595
|
+
### Tables
|
|
596
|
+
|
|
597
|
+
Tables can be added using the `table` method. The method accepts several optional paramters to control the layout and style of the table cells.
|
|
598
|
+
|
|
599
|
+
table data, border: 8 do
|
|
600
|
+
cell_style rows(0), background_color: '4a86e8', bold: true
|
|
601
|
+
end
|
|
602
|
+
|
|
603
|
+
Given the a data structure with two rows and five columns, the `table` method would produce the following XML:
|
|
604
|
+
|
|
605
|
+
<w:tbl>
|
|
606
|
+
<w:tblPr>
|
|
607
|
+
<w:tblStyle w:val="KixTable1"/>
|
|
608
|
+
<w:bidiVisual w:val="0"/>
|
|
609
|
+
<w:tblW w:w="10800.0" w:type="dxa"/>
|
|
610
|
+
<w:jc w:val="left"/>
|
|
611
|
+
<w:tblBorders>
|
|
612
|
+
<w:top w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
613
|
+
<w:left w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
614
|
+
<w:bottom w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
615
|
+
<w:right w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
616
|
+
<w:insideH w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
617
|
+
<w:insideV w:color="000000" w:space="0" w:val="single" w:sz="8"/>
|
|
618
|
+
</w:tblBorders>
|
|
619
|
+
<w:tblLayout w:type="fixed"/>
|
|
620
|
+
<w:tblLook w:val="0600"/>
|
|
621
|
+
</w:tblPr>
|
|
622
|
+
<w:tblGrid>
|
|
623
|
+
<w:gridCol w:w="2160"/>
|
|
624
|
+
<w:gridCol w:w="2160"/>
|
|
625
|
+
<w:gridCol w:w="2160"/>
|
|
626
|
+
<w:gridCol w:w="2160"/>
|
|
627
|
+
<w:gridCol w:w="2160"/>
|
|
628
|
+
<w:tblGridChange w:id="0">
|
|
629
|
+
<w:tblGrid>
|
|
630
|
+
<w:gridCol w:w="2160"/>
|
|
631
|
+
<w:gridCol w:w="2160"/>
|
|
632
|
+
<w:gridCol w:w="2160"/>
|
|
633
|
+
<w:gridCol w:w="2160"/>
|
|
634
|
+
<w:gridCol w:w="2160"/>
|
|
635
|
+
</w:tblGrid>
|
|
636
|
+
</w:tblGridChange>
|
|
637
|
+
</w:tblGrid>
|
|
638
|
+
<w:tr>
|
|
639
|
+
<w:tc>
|
|
640
|
+
<w:tcPr>
|
|
641
|
+
<w:shd w:fill="4a86e8"/>
|
|
642
|
+
<w:tcMar>
|
|
643
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
644
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
645
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
646
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
647
|
+
</w:tcMar>
|
|
648
|
+
</w:tcPr>
|
|
649
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
650
|
+
<w:pPr>
|
|
651
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
652
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
653
|
+
<w:contextualSpacing w:val="0"/>
|
|
654
|
+
</w:pPr>
|
|
655
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
656
|
+
<w:rPr>
|
|
657
|
+
<w:b w:val="1"/>
|
|
658
|
+
<w:color w:val="ffffff"/>
|
|
659
|
+
<w:rtl w:val="0"/>
|
|
660
|
+
</w:rPr>
|
|
661
|
+
<w:t xml:space="preserve">Field</w:t>
|
|
662
|
+
</w:r>
|
|
663
|
+
</w:p>
|
|
664
|
+
</w:tc>
|
|
665
|
+
<w:tc>
|
|
666
|
+
<w:tcPr>
|
|
667
|
+
<w:shd w:fill="4a86e8"/>
|
|
668
|
+
<w:tcMar>
|
|
669
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
670
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
671
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
672
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
673
|
+
</w:tcMar>
|
|
674
|
+
</w:tcPr>
|
|
675
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
676
|
+
<w:pPr>
|
|
677
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
678
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
679
|
+
<w:contextualSpacing w:val="0"/>
|
|
680
|
+
</w:pPr>
|
|
681
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
682
|
+
<w:rPr>
|
|
683
|
+
<w:b w:val="1"/>
|
|
684
|
+
<w:color w:val="ffffff"/>
|
|
685
|
+
<w:rtl w:val="0"/>
|
|
686
|
+
</w:rPr>
|
|
687
|
+
<w:t xml:space="preserve">Response</w:t>
|
|
688
|
+
</w:r>
|
|
689
|
+
</w:p>
|
|
690
|
+
</w:tc>
|
|
691
|
+
<w:tc>
|
|
692
|
+
<w:tcPr>
|
|
693
|
+
<w:shd w:fill="4a86e8"/>
|
|
694
|
+
<w:tcMar>
|
|
695
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
696
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
697
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
698
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
699
|
+
</w:tcMar>
|
|
700
|
+
</w:tcPr>
|
|
701
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
702
|
+
<w:pPr>
|
|
703
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
704
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
705
|
+
<w:contextualSpacing w:val="0"/>
|
|
706
|
+
</w:pPr>
|
|
707
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
708
|
+
<w:rPr>
|
|
709
|
+
<w:b w:val="1"/>
|
|
710
|
+
<w:color w:val="ffffff"/>
|
|
711
|
+
<w:rtl w:val="0"/>
|
|
712
|
+
</w:rPr>
|
|
713
|
+
<w:t xml:space="preserve">Perf. Quality</w:t>
|
|
714
|
+
</w:r>
|
|
715
|
+
</w:p>
|
|
716
|
+
</w:tc>
|
|
717
|
+
<w:tc>
|
|
718
|
+
<w:tcPr>
|
|
719
|
+
<w:shd w:fill="4a86e8"/>
|
|
720
|
+
<w:tcMar>
|
|
721
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
722
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
723
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
724
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
725
|
+
</w:tcMar>
|
|
726
|
+
</w:tcPr>
|
|
727
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
728
|
+
<w:pPr>
|
|
729
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
730
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
731
|
+
<w:contextualSpacing w:val="0"/>
|
|
732
|
+
</w:pPr>
|
|
733
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
734
|
+
<w:rPr>
|
|
735
|
+
<w:b w:val="1"/>
|
|
736
|
+
<w:color w:val="ffffff"/>
|
|
737
|
+
<w:rtl w:val="0"/>
|
|
738
|
+
</w:rPr>
|
|
739
|
+
<w:t xml:space="preserve">Data Quality</w:t>
|
|
740
|
+
</w:r>
|
|
741
|
+
</w:p>
|
|
742
|
+
</w:tc>
|
|
743
|
+
<w:tc>
|
|
744
|
+
<w:tcPr>
|
|
745
|
+
<w:shd w:fill="4a86e8"/>
|
|
746
|
+
<w:tcMar>
|
|
747
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
748
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
749
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
750
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
751
|
+
</w:tcMar>
|
|
752
|
+
</w:tcPr>
|
|
753
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
754
|
+
<w:pPr>
|
|
755
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
756
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
757
|
+
<w:contextualSpacing w:val="0"/>
|
|
758
|
+
</w:pPr>
|
|
759
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
760
|
+
<w:rPr>
|
|
761
|
+
<w:b w:val="1"/>
|
|
762
|
+
<w:color w:val="ffffff"/>
|
|
763
|
+
<w:rtl w:val="0"/>
|
|
764
|
+
</w:rPr>
|
|
765
|
+
<w:t xml:space="preserve">State</w:t>
|
|
766
|
+
</w:r>
|
|
767
|
+
</w:p>
|
|
768
|
+
</w:tc>
|
|
769
|
+
</w:tr>
|
|
770
|
+
<w:tr>
|
|
771
|
+
<w:tc>
|
|
772
|
+
<w:tcPr>
|
|
773
|
+
<w:tcMar>
|
|
774
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
775
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
776
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
777
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
778
|
+
</w:tcMar>
|
|
779
|
+
</w:tcPr>
|
|
780
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
781
|
+
<w:pPr>
|
|
782
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
783
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
784
|
+
<w:contextualSpacing w:val="0"/>
|
|
785
|
+
</w:pPr>
|
|
786
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
787
|
+
<w:rPr>
|
|
788
|
+
<w:rtl w:val="0"/>
|
|
789
|
+
</w:rPr>
|
|
790
|
+
<w:t xml:space="preserve">After-Hours trading</w:t>
|
|
791
|
+
</w:r>
|
|
792
|
+
</w:p>
|
|
793
|
+
</w:tc>
|
|
794
|
+
<w:tc>
|
|
795
|
+
<w:tcPr>
|
|
796
|
+
<w:tcMar>
|
|
797
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
798
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
799
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
800
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
801
|
+
</w:tcMar>
|
|
802
|
+
</w:tcPr>
|
|
803
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
804
|
+
<w:pPr>
|
|
805
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
806
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
807
|
+
<w:contextualSpacing w:val="0"/>
|
|
808
|
+
</w:pPr>
|
|
809
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
810
|
+
<w:rPr>
|
|
811
|
+
<w:rtl w:val="0"/>
|
|
812
|
+
</w:rPr>
|
|
813
|
+
<w:t xml:space="preserve">Yes</w:t>
|
|
814
|
+
</w:r>
|
|
815
|
+
</w:p>
|
|
816
|
+
</w:tc>
|
|
817
|
+
<w:tc>
|
|
818
|
+
<w:tcPr>
|
|
819
|
+
<w:tcMar>
|
|
820
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
821
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
822
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
823
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
824
|
+
</w:tcMar>
|
|
825
|
+
</w:tcPr>
|
|
826
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
827
|
+
<w:pPr>
|
|
828
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
829
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
830
|
+
<w:contextualSpacing w:val="0"/>
|
|
831
|
+
</w:pPr>
|
|
832
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
833
|
+
<w:rPr>
|
|
834
|
+
<w:rtl w:val="0"/>
|
|
835
|
+
</w:rPr>
|
|
836
|
+
<w:t xml:space="preserve">B</w:t>
|
|
837
|
+
</w:r>
|
|
838
|
+
</w:p>
|
|
839
|
+
</w:tc>
|
|
840
|
+
<w:tc>
|
|
841
|
+
<w:tcPr>
|
|
842
|
+
<w:tcMar>
|
|
843
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
844
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
845
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
846
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
847
|
+
</w:tcMar>
|
|
848
|
+
</w:tcPr>
|
|
849
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
850
|
+
<w:pPr>
|
|
851
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
852
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
853
|
+
<w:contextualSpacing w:val="0"/>
|
|
854
|
+
</w:pPr>
|
|
855
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
856
|
+
<w:rPr>
|
|
857
|
+
<w:rtl w:val="0"/>
|
|
858
|
+
</w:rPr>
|
|
859
|
+
<w:t xml:space="preserve">B</w:t>
|
|
860
|
+
</w:r>
|
|
861
|
+
</w:p>
|
|
862
|
+
</w:tc>
|
|
863
|
+
<w:tc>
|
|
864
|
+
<w:tcPr>
|
|
865
|
+
<w:tcMar>
|
|
866
|
+
<w:top w:w="100.0" w:type="dxa"/>
|
|
867
|
+
<w:left w:w="100.0" w:type="dxa"/>
|
|
868
|
+
<w:bottom w:w="100.0" w:type="dxa"/>
|
|
869
|
+
<w:right w:w="100.0" w:type="dxa"/>
|
|
870
|
+
</w:tcMar>
|
|
871
|
+
</w:tcPr>
|
|
872
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
873
|
+
<w:pPr>
|
|
874
|
+
<w:spacing w:lineRule="auto" w:after="0" w:line="240" w:before="0"/>
|
|
875
|
+
<w:ind w:left="0" w:firstLine="0"/>
|
|
876
|
+
<w:contextualSpacing w:val="0"/>
|
|
877
|
+
</w:pPr>
|
|
878
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
879
|
+
<w:rPr>
|
|
880
|
+
<w:rtl w:val="0"/>
|
|
881
|
+
</w:rPr>
|
|
882
|
+
<w:t xml:space="preserve">published</w:t>
|
|
883
|
+
</w:r>
|
|
884
|
+
</w:p>
|
|
885
|
+
</w:tc>
|
|
886
|
+
</w:tr>
|
|
887
|
+
|
|
888
|
+
### Line Breaks
|
|
889
|
+
|
|
890
|
+
Line breaks can be added via the `br` method. The method accepts no parameters.
|
|
891
|
+
|
|
892
|
+
docx.br # adds a blank line using the default paragrpah style.
|
|
893
|
+
|
|
894
|
+
The `br` command will produce the folowing XML:
|
|
895
|
+
|
|
896
|
+
<w:p w:rsidP="00000000" w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000" w:rsidRDefault="00000000">
|
|
897
|
+
<w:pPr>
|
|
898
|
+
<w:contextualSpacing w:val="0"/>
|
|
899
|
+
</w:pPr>
|
|
900
|
+
<w:r w:rsidRPr="00000000" w:rsidR="00000000" w:rsidDel="00000000">
|
|
901
|
+
<w:rPr>
|
|
902
|
+
<w:rtl w:val="0"/>
|
|
903
|
+
</w:rPr>
|
|
904
|
+
</w:r>
|
|
905
|
+
</w:p>
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
## Template Rendering
|
|
909
|
+
|
|
910
|
+
Caracal includes [Tilt](https://github.com/rtomayko/tilt) integration to facilitate its inclusion in other frameworks. Rails integration can be added via the [Caracal-Rails](https://github.com/trade-informatics/caracal-rails) gem.
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
## Defaults
|
|
914
|
+
|
|
915
|
+
[Unsure how best to handle this without code exploration. Not a critical element for the first version.]
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
## Contributing
|
|
919
|
+
|
|
920
|
+
1. Fork it ( https://github.com/trade-informatics/caracal/fork )
|
|
921
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
922
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
923
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
924
|
+
5. Create a new Pull Request
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
## Why is It Called Caracal?
|
|
928
|
+
|
|
929
|
+
Because my son likes caracals. :)
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
## Inspiration
|
|
933
|
+
|
|
934
|
+
A tip of the hat to the wonderful PDF generation library [Prawn](https://github.com/prawnpdf/prawn).
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
## License
|
|
938
|
+
|
|
939
|
+
Copyright (c) 2014 Trade Informatics, Inc
|
|
940
|
+
|
|
941
|
+
[MIT License](https://github.com/trade-informatics/caracal/blob/master/LICENSE.txt)
|