axlsx-builder 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/axlsx-builder.iml +27 -0
- data/.idea/misc.xml +14 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +252 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/axlsx-builder.gemspec +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/axlsx/builder.rb +496 -0
- data/lib/axlsx/builder/version.rb +5 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f38f6a8ca59c2a6971a1ad62df33a076c3a26c4
|
4
|
+
data.tar.gz: 067d8b0173c37e20be040fbd89ff484365b122b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00afcc89be4cf37f54909fef245e8ddb3fbbe2b01de9a5bfa34710a6971080bf83e69c19b429308fa1245b158e2265d2ae3d6ce1714b675dee980a4b24bf7bb8
|
7
|
+
data.tar.gz: 8f81725e1dc5538b0ad93e504602144b884c61b5caa42a2ffd20ceb51b35957c46f6d6fe4e5b67ec8572d65a7ccbe5166d6d31f3292e1b0457741c225791493b
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build axlsx-builder-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install axlsx-builder-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install axlsx-builder-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push axlsx-builder-0.1.0.gem to Rubygems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="New Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$">
|
14
|
+
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
|
15
|
+
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
|
16
|
+
</content>
|
17
|
+
<orderEntry type="inheritedJdk" />
|
18
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="axlsx (v2.0.1, rbenv: 2.2.3) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.12.1, rbenv: 2.2.3) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="htmlentities (v4.3.4, rbenv: 2.2.3) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.0.0, rbenv: 2.2.3) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.7.2, rbenv: 2.2.3) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, rbenv: 2.2.3) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.0.0, rbenv: 2.2.3) [gem]" level="application" />
|
26
|
+
</component>
|
27
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
4
|
+
<OptionsSetting value="true" id="Add" />
|
5
|
+
<OptionsSetting value="true" id="Remove" />
|
6
|
+
<OptionsSetting value="true" id="Checkout" />
|
7
|
+
<OptionsSetting value="true" id="Update" />
|
8
|
+
<OptionsSetting value="true" id="Status" />
|
9
|
+
<OptionsSetting value="true" id="Edit" />
|
10
|
+
<ConfirmationsSetting value="0" id="Add" />
|
11
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
12
|
+
</component>
|
13
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.2.3" project-jdk-type="RUBY_SDK" />
|
14
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/axlsx-builder.iml" filepath="$PROJECT_DIR$/.idea/axlsx-builder.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="1ec5680b-db0f-4fa9-b451-9b67268db70c" name="Default" comment="">
|
5
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
6
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/axlsx-builder.gemspec" afterPath="$PROJECT_DIR$/axlsx-builder.gemspec" />
|
7
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/axlsx/builder/version.rb" afterPath="$PROJECT_DIR$/lib/axlsx/builder/version.rb" />
|
8
|
+
</list>
|
9
|
+
<ignored path="axlsx-builder.iws" />
|
10
|
+
<ignored path=".idea/workspace.xml" />
|
11
|
+
<ignored path="$PROJECT_DIR$/.bundle/" />
|
12
|
+
<ignored path="$PROJECT_DIR$/vendor/bundle/" />
|
13
|
+
<ignored path=".idea/dataSources.local.xml" />
|
14
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
15
|
+
<option name="TRACKING_ENABLED" value="true" />
|
16
|
+
<option name="SHOW_DIALOG" value="false" />
|
17
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
18
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
19
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
20
|
+
</component>
|
21
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
22
|
+
<component name="CreatePatchCommitExecutor">
|
23
|
+
<option name="PATCH_PATH" value="" />
|
24
|
+
</component>
|
25
|
+
<component name="FavoritesManager">
|
26
|
+
<favorites_list name="axlsx-builder" />
|
27
|
+
</component>
|
28
|
+
<component name="FileEditorManager">
|
29
|
+
<leaf>
|
30
|
+
<file leaf-file-name="builder.rb" pinned="false" current-in-tab="false">
|
31
|
+
<entry file="file://$PROJECT_DIR$/lib/axlsx/builder.rb">
|
32
|
+
<provider selected="true" editor-type-id="text-editor">
|
33
|
+
<state relative-caret-position="644">
|
34
|
+
<caret line="496" column="0" selection-start-line="496" selection-start-column="0" selection-end-line="496" selection-end-column="0" />
|
35
|
+
<folding />
|
36
|
+
</state>
|
37
|
+
</provider>
|
38
|
+
</entry>
|
39
|
+
</file>
|
40
|
+
<file leaf-file-name="axlsx-builder.gemspec" pinned="false" current-in-tab="false">
|
41
|
+
<entry file="file://$PROJECT_DIR$/axlsx-builder.gemspec">
|
42
|
+
<provider selected="true" editor-type-id="text-editor">
|
43
|
+
<state relative-caret-position="390">
|
44
|
+
<caret line="26" column="3" selection-start-line="26" selection-start-column="3" selection-end-line="26" selection-end-column="3" />
|
45
|
+
<folding />
|
46
|
+
</state>
|
47
|
+
</provider>
|
48
|
+
</entry>
|
49
|
+
</file>
|
50
|
+
<file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
|
51
|
+
<entry file="file://$PROJECT_DIR$/lib/axlsx/builder/version.rb">
|
52
|
+
<provider selected="true" editor-type-id="text-editor">
|
53
|
+
<state relative-caret-position="75">
|
54
|
+
<caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
|
55
|
+
<folding />
|
56
|
+
</state>
|
57
|
+
</provider>
|
58
|
+
</entry>
|
59
|
+
</file>
|
60
|
+
</leaf>
|
61
|
+
</component>
|
62
|
+
<component name="Git.Settings">
|
63
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
64
|
+
</component>
|
65
|
+
<component name="IdeDocumentHistory">
|
66
|
+
<option name="CHANGED_PATHS">
|
67
|
+
<list>
|
68
|
+
<option value="$PROJECT_DIR$/lib/axlsx/builder.rb" />
|
69
|
+
<option value="$PROJECT_DIR$/axlsx-builder.gemspec" />
|
70
|
+
<option value="$PROJECT_DIR$/lib/axlsx/builder/version.rb" />
|
71
|
+
</list>
|
72
|
+
</option>
|
73
|
+
</component>
|
74
|
+
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
75
|
+
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
76
|
+
<component name="JsGulpfileManager">
|
77
|
+
<detection-done>true</detection-done>
|
78
|
+
<sorting>DEFINITION_ORDER</sorting>
|
79
|
+
</component>
|
80
|
+
<component name="ProjectFrameBounds">
|
81
|
+
<option name="x" value="73" />
|
82
|
+
<option name="y" value="23" />
|
83
|
+
<option name="width" value="1200" />
|
84
|
+
<option name="height" value="745" />
|
85
|
+
</component>
|
86
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
87
|
+
<OptionsSetting value="true" id="Add" />
|
88
|
+
<OptionsSetting value="true" id="Remove" />
|
89
|
+
<OptionsSetting value="true" id="Checkout" />
|
90
|
+
<OptionsSetting value="true" id="Update" />
|
91
|
+
<OptionsSetting value="true" id="Status" />
|
92
|
+
<OptionsSetting value="true" id="Edit" />
|
93
|
+
<ConfirmationsSetting value="0" id="Add" />
|
94
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
95
|
+
</component>
|
96
|
+
<component name="ProjectView">
|
97
|
+
<navigator currentView="ProjectPane" proportions="" version="1">
|
98
|
+
<flattenPackages />
|
99
|
+
<showMembers />
|
100
|
+
<showModules />
|
101
|
+
<showLibraryContents />
|
102
|
+
<hideEmptyPackages />
|
103
|
+
<abbreviatePackageNames />
|
104
|
+
<autoscrollToSource />
|
105
|
+
<autoscrollFromSource />
|
106
|
+
<sortByType />
|
107
|
+
<manualOrder />
|
108
|
+
<foldersAlwaysOnTop value="true" />
|
109
|
+
</navigator>
|
110
|
+
<panes>
|
111
|
+
<pane id="ProjectPane">
|
112
|
+
<subPane>
|
113
|
+
<PATH>
|
114
|
+
<PATH_ELEMENT>
|
115
|
+
<option name="myItemId" value="axlsx-builder" />
|
116
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
117
|
+
</PATH_ELEMENT>
|
118
|
+
</PATH>
|
119
|
+
<PATH>
|
120
|
+
<PATH_ELEMENT>
|
121
|
+
<option name="myItemId" value="axlsx-builder" />
|
122
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
123
|
+
</PATH_ELEMENT>
|
124
|
+
<PATH_ELEMENT>
|
125
|
+
<option name="myItemId" value="axlsx-builder" />
|
126
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
127
|
+
</PATH_ELEMENT>
|
128
|
+
</PATH>
|
129
|
+
<PATH>
|
130
|
+
<PATH_ELEMENT>
|
131
|
+
<option name="myItemId" value="axlsx-builder" />
|
132
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
133
|
+
</PATH_ELEMENT>
|
134
|
+
<PATH_ELEMENT>
|
135
|
+
<option name="myItemId" value="axlsx-builder" />
|
136
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
137
|
+
</PATH_ELEMENT>
|
138
|
+
<PATH_ELEMENT>
|
139
|
+
<option name="myItemId" value="lib" />
|
140
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
141
|
+
</PATH_ELEMENT>
|
142
|
+
<PATH_ELEMENT>
|
143
|
+
<option name="myItemId" value="axlsx" />
|
144
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
145
|
+
</PATH_ELEMENT>
|
146
|
+
</PATH>
|
147
|
+
<PATH>
|
148
|
+
<PATH_ELEMENT>
|
149
|
+
<option name="myItemId" value="axlsx-builder" />
|
150
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
151
|
+
</PATH_ELEMENT>
|
152
|
+
<PATH_ELEMENT>
|
153
|
+
<option name="myItemId" value="axlsx-builder" />
|
154
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
155
|
+
</PATH_ELEMENT>
|
156
|
+
<PATH_ELEMENT>
|
157
|
+
<option name="myItemId" value="lib" />
|
158
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
159
|
+
</PATH_ELEMENT>
|
160
|
+
<PATH_ELEMENT>
|
161
|
+
<option name="myItemId" value="axlsx" />
|
162
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
163
|
+
</PATH_ELEMENT>
|
164
|
+
<PATH_ELEMENT>
|
165
|
+
<option name="myItemId" value="builder" />
|
166
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
167
|
+
</PATH_ELEMENT>
|
168
|
+
</PATH>
|
169
|
+
</subPane>
|
170
|
+
</pane>
|
171
|
+
<pane id="Scratches" />
|
172
|
+
<pane id="Scope" />
|
173
|
+
</panes>
|
174
|
+
</component>
|
175
|
+
<component name="PropertiesComponent">
|
176
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
177
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
178
|
+
</component>
|
179
|
+
<component name="ShelveChangesManager" show_recycled="false">
|
180
|
+
<option name="remove_strategy" value="false" />
|
181
|
+
</component>
|
182
|
+
<component name="TaskManager">
|
183
|
+
<task active="true" id="Default" summary="Default task">
|
184
|
+
<changelist id="1ec5680b-db0f-4fa9-b451-9b67268db70c" name="Default" comment="" />
|
185
|
+
<created>1467385833150</created>
|
186
|
+
<option name="number" value="Default" />
|
187
|
+
<option name="presentableId" value="Default" />
|
188
|
+
<updated>1467385833150</updated>
|
189
|
+
<workItem from="1467385834420" duration="432000" />
|
190
|
+
</task>
|
191
|
+
<servers />
|
192
|
+
</component>
|
193
|
+
<component name="TimeTrackingManager">
|
194
|
+
<option name="totallyTimeSpent" value="432000" />
|
195
|
+
</component>
|
196
|
+
<component name="ToolWindowManager">
|
197
|
+
<frame x="73" y="23" width="1200" height="745" extended-state="0" />
|
198
|
+
<editor active="true" />
|
199
|
+
<layout>
|
200
|
+
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
201
|
+
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
202
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
203
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
204
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
205
|
+
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
206
|
+
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
207
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
208
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
209
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
210
|
+
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
211
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
212
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
213
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
214
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
215
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
216
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
217
|
+
</layout>
|
218
|
+
</component>
|
219
|
+
<component name="VcsContentAnnotationSettings">
|
220
|
+
<option name="myLimit" value="2678400000" />
|
221
|
+
</component>
|
222
|
+
<component name="XDebuggerManager">
|
223
|
+
<breakpoint-manager />
|
224
|
+
<watches-manager />
|
225
|
+
</component>
|
226
|
+
<component name="editorHistoryManager">
|
227
|
+
<entry file="file://$PROJECT_DIR$/lib/axlsx/builder.rb">
|
228
|
+
<provider selected="true" editor-type-id="text-editor">
|
229
|
+
<state relative-caret-position="644">
|
230
|
+
<caret line="496" column="0" selection-start-line="496" selection-start-column="0" selection-end-line="496" selection-end-column="0" />
|
231
|
+
<folding />
|
232
|
+
</state>
|
233
|
+
</provider>
|
234
|
+
</entry>
|
235
|
+
<entry file="file://$PROJECT_DIR$/axlsx-builder.gemspec">
|
236
|
+
<provider selected="true" editor-type-id="text-editor">
|
237
|
+
<state relative-caret-position="390">
|
238
|
+
<caret line="26" column="3" selection-start-line="26" selection-start-column="3" selection-end-line="26" selection-end-column="3" />
|
239
|
+
<folding />
|
240
|
+
</state>
|
241
|
+
</provider>
|
242
|
+
</entry>
|
243
|
+
<entry file="file://$PROJECT_DIR$/lib/axlsx/builder/version.rb">
|
244
|
+
<provider selected="true" editor-type-id="text-editor">
|
245
|
+
<state relative-caret-position="75">
|
246
|
+
<caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
|
247
|
+
<folding />
|
248
|
+
</state>
|
249
|
+
</provider>
|
250
|
+
</entry>
|
251
|
+
</component>
|
252
|
+
</project>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at shaynetremblay@hotmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 MainShayne233
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Axlsx::Builder
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/axlsx/builder`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'axlsx-builder'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install axlsx-builder
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/axlsx-builder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'axlsx/builder/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "axlsx-builder"
|
8
|
+
spec.version = Axlsx::Builder::VERSION
|
9
|
+
spec.authors = ["MainShayne233"]
|
10
|
+
spec.email = ["shaynetremblay@hotmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'An extension of Axlsx that allows you create spreadsheets blueprints for '\
|
13
|
+
'easy sheet generation, manipulation, and data input.'
|
14
|
+
spec.homepage = 'https://github.com/MainShayne233/axlsx-builder'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_dependency 'axlsx', '~> 2.0.1.pre'
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "axlsx/builder"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,496 @@
|
|
1
|
+
module Axlsx
|
2
|
+
module Builder
|
3
|
+
class Object
|
4
|
+
def initialize(attrs={})
|
5
|
+
attrs.each { |key, val| send("#{key.to_s}=", val) }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Cell < Object
|
10
|
+
attr_accessor :text
|
11
|
+
attr_accessor :title
|
12
|
+
attr_accessor :row
|
13
|
+
attr_accessor :col
|
14
|
+
end
|
15
|
+
|
16
|
+
class Alignment
|
17
|
+
attr_accessor :horizontal, :vertical
|
18
|
+
|
19
|
+
def initialize(horizontal: :left, vertical: :center)
|
20
|
+
@horizontal = horizontal
|
21
|
+
@vertical = vertical
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Font < Object
|
26
|
+
attr_accessor :name, :size, :color
|
27
|
+
|
28
|
+
def initialize(attrs={})
|
29
|
+
@name = 'Liberation Sans'
|
30
|
+
@size = 10
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Format < Object
|
36
|
+
attr_accessor :color, :font, :style, :borders, :border_thickness, :alignment
|
37
|
+
|
38
|
+
def initialize(attrs={})
|
39
|
+
@font = Font.new
|
40
|
+
@alignment = Alignment.new
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Position
|
46
|
+
attr_writer :col
|
47
|
+
attr_accessor :row
|
48
|
+
|
49
|
+
def initialize(row: 0, col: 0)
|
50
|
+
@row = row
|
51
|
+
@col = col
|
52
|
+
end
|
53
|
+
|
54
|
+
# Must subtract 1 from col as it is 0 based, not 1 based.
|
55
|
+
def col
|
56
|
+
@col-1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Element < Object
|
61
|
+
attr_reader :pos
|
62
|
+
attr_accessor :text, :format, :borders, :border_thickness,
|
63
|
+
:merge, :comment
|
64
|
+
|
65
|
+
def initialize(attrs={})
|
66
|
+
@pos = Position.new
|
67
|
+
@format = Format.new
|
68
|
+
super
|
69
|
+
end
|
70
|
+
|
71
|
+
def pos=(pos)
|
72
|
+
@pos = Position.new(row: pos[0], col: pos[1])
|
73
|
+
end
|
74
|
+
|
75
|
+
def row; pos.row; end
|
76
|
+
def col; pos.col; end
|
77
|
+
def style; format.style; end
|
78
|
+
def font; format.font; end
|
79
|
+
def color; format.color; end
|
80
|
+
def h_align; format.alignment.horizontal; end
|
81
|
+
def v_align; format.alignment.vertical; end
|
82
|
+
|
83
|
+
def combined_style
|
84
|
+
combined_style = {}
|
85
|
+
if self.style
|
86
|
+
combined_style.merge!(b: true) if self.style.include? :bold
|
87
|
+
combined_style.merge!(i: true) if self.style.include? :italic
|
88
|
+
combined_style.merge!(u: true) if self.style.include? :underline
|
89
|
+
combined_style.merge!(alignment: {horizontal: :center}) if self.style.include? :center
|
90
|
+
combined_style.merge!(sz: 12) if self.style.include? :lg_font
|
91
|
+
end
|
92
|
+
combined_style.merge!(sz: self.font.size)
|
93
|
+
combined_style.merge!(font_name: self.font.name)
|
94
|
+
combined_style.merge!(bg_color: self.color) if self.color
|
95
|
+
combined_style.merge!(fg_color: self.font.color)
|
96
|
+
combined_style.merge!(alignment: {horizontal: h_align, vertical: v_align})
|
97
|
+
if self.borders == true
|
98
|
+
combined_style.merge! border: {style: self.border_thickness || :medium, color: '00000000'}
|
99
|
+
elsif self.borders
|
100
|
+
combined_style.merge! border: {style: self.border_thickness || :medium, color: '00000000', edges: self.borders}
|
101
|
+
end
|
102
|
+
combined_style
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class Title < Element
|
107
|
+
attr_accessor :list, :hyperlink
|
108
|
+
|
109
|
+
def initialize attrs
|
110
|
+
h_align = :center # Default
|
111
|
+
v_align = :center # Default
|
112
|
+
attrs.each {|key, val| self.send("#{key.to_s}=", val)}
|
113
|
+
super
|
114
|
+
end
|
115
|
+
|
116
|
+
def combined_style
|
117
|
+
combined_style = super
|
118
|
+
combined_style.merge!(b: true, border: {style: :thick, color: '00000000'})
|
119
|
+
combined_style.merge!(bg_color: self.color) if self.color
|
120
|
+
combined_style
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
class Blueprint
|
126
|
+
attr_accessor :sheet, :elements, :column_titles, :row_titles, :column_titles_start,
|
127
|
+
:row_titles_start, :row_data, :column_data, :max, :column_title_row_height, :format
|
128
|
+
|
129
|
+
def initialize options = {}
|
130
|
+
options[:format] ||= Format.new
|
131
|
+
|
132
|
+
self.elements = if options[:elements]
|
133
|
+
options[:elements].map do |elem|
|
134
|
+
elem.merge!(format: options[:format]) unless elem[:format]
|
135
|
+
Element.new(elem)
|
136
|
+
end
|
137
|
+
else
|
138
|
+
[]
|
139
|
+
end
|
140
|
+
self.column_titles = options[:column_titles] ? options[:column_titles].map{|elem| Title.new(elem)} : []
|
141
|
+
self.row_titles = options[:row_titles] ? options[:row_titles].map{|elem| Title.new(elem)} : []
|
142
|
+
self.column_titles_start = options[:column_titles_start] || [1,1]
|
143
|
+
self.row_titles_start = options[:row_titles_start] || [1,1]
|
144
|
+
self.column_title_row_height = options[:column_title_row_height]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
class Worksheet
|
154
|
+
attr_accessor :column_title_indexes, :row_title_indexes, :blueprint, :column_data, :row_data
|
155
|
+
|
156
|
+
def build!
|
157
|
+
if self.column_data
|
158
|
+
self.blueprint.column_data = self.column_data.map{|elem| Builder::Cell.new(elem)}
|
159
|
+
end
|
160
|
+
|
161
|
+
if self.row_data
|
162
|
+
self.blueprint.row_data = self.row_data.map{|elem| Builder::Cell.new(elem)}
|
163
|
+
end
|
164
|
+
|
165
|
+
set_column_title_indexes
|
166
|
+
|
167
|
+
set_max_row_and_column
|
168
|
+
|
169
|
+
set_row_title_indexes
|
170
|
+
|
171
|
+
set_column_widths
|
172
|
+
|
173
|
+
set_row_heights
|
174
|
+
|
175
|
+
place_elements
|
176
|
+
|
177
|
+
place_column_titles
|
178
|
+
|
179
|
+
set_lists_for_column_titles
|
180
|
+
|
181
|
+
place_row_titles
|
182
|
+
|
183
|
+
set_lists_for_row_titles
|
184
|
+
|
185
|
+
set_column_title_row_height
|
186
|
+
|
187
|
+
place_column_data if self.blueprint.column_data
|
188
|
+
|
189
|
+
place_row_data if self.blueprint.row_data
|
190
|
+
|
191
|
+
move_lists_sheet_to_end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
|
196
|
+
def set_column_title_indexes
|
197
|
+
self.column_title_indexes = {}
|
198
|
+
self.blueprint.column_titles.each_with_index {|elem, index| self.column_title_indexes[elem.text] = index+self.blueprint.column_titles_start[1]-1}
|
199
|
+
end
|
200
|
+
|
201
|
+
def set_row_title_indexes
|
202
|
+
self.row_title_indexes = {}
|
203
|
+
self.blueprint.row_titles.each_with_index {|elem, index| self.row_title_indexes[elem.text] = index+self.blueprint.row_titles_start[0]-1}
|
204
|
+
end
|
205
|
+
|
206
|
+
def set_column_widths
|
207
|
+
col_widths = {}
|
208
|
+
|
209
|
+
element_strings = []
|
210
|
+
|
211
|
+
self.blueprint.elements.each do |element|
|
212
|
+
longest_line = element.text.split("\n").max_by{|line| line.length}
|
213
|
+
element_strings.push [element.col, longest_line || '']
|
214
|
+
(1..element.merge).each {|column| col_widths[column] = 0} if element.merge
|
215
|
+
end
|
216
|
+
|
217
|
+
element_strings.each do |col, text|
|
218
|
+
col_widths[col] ||= 0
|
219
|
+
col_widths[col] = text.length if text.length > col_widths[col]
|
220
|
+
end
|
221
|
+
|
222
|
+
self.blueprint.column_titles.each_with_index do |elem, index|
|
223
|
+
col_widths[index+self.blueprint.column_titles_start[1]-1] ||= 0
|
224
|
+
col_widths[index+self.blueprint.column_titles_start[1]-1] = elem.text.length if elem.text.length > col_widths[index+self.blueprint.column_titles_start[1]-1]
|
225
|
+
end
|
226
|
+
|
227
|
+
unless self.blueprint.row_titles.empty?
|
228
|
+
col_widths[self.blueprint.row_titles_start[1]-1] ||= 0
|
229
|
+
max_row_title = self.blueprint.row_titles.max_by{|elem| elem.text.length}.text.length
|
230
|
+
col_widths[self.blueprint.row_titles_start[1]-1] = max_row_title if max_row_title > col_widths[self.blueprint.row_titles_start[1]-1]
|
231
|
+
end
|
232
|
+
|
233
|
+
if self.blueprint.column_data
|
234
|
+
self.blueprint.column_data.each do |elem|
|
235
|
+
title_column = self.column_title_indexes[elem.title]
|
236
|
+
col_widths[title_column] ||= 0
|
237
|
+
col_widths[title_column] = elem.text.length if elem.text.length > col_widths[title_column]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
if self.blueprint.row_data
|
242
|
+
self.blueprint.row_data.each do |elem|
|
243
|
+
self.blueprint.row_data.select{|data| data.text == elem.text}.each_with_index do |title_data, index|
|
244
|
+
column = self.blueprint.row_titles_start[1] + 1 + index
|
245
|
+
col_widths[column] ||= 0
|
246
|
+
col_widths[column] = title_data.text.length if title_data.text.length > col_widths[column]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
widths = (0..self.blueprint.max[:col].to_i).map{|col| col_widths[col] ? col_widths[col]+4 : 0}
|
252
|
+
self.column_widths *widths
|
253
|
+
end
|
254
|
+
|
255
|
+
def set_row_heights
|
256
|
+
row_heights = {}
|
257
|
+
|
258
|
+
self.blueprint.elements.each do |elem|
|
259
|
+
row_heights[elem.row] ||= 0
|
260
|
+
height = elem.text.split("\n").count * 10 + (elem.font.size / 3)
|
261
|
+
row_heights[elem.row] = height if height > row_heights[elem.row]
|
262
|
+
end
|
263
|
+
|
264
|
+
unless self.blueprint.column_titles.empty?
|
265
|
+
max_column_title_height = self.blueprint.column_titles.map{|elem| elem.text.split("\n").size}.max * 10 + 10
|
266
|
+
row_heights[self.blueprint.column_titles_start[0]] ||= 0
|
267
|
+
row_heights[self.blueprint.column_titles_start[0]] = max_column_title_height if max_column_title_height > row_heights[self.blueprint.column_titles_start[0]]
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
(0..self.blueprint.max[:row].to_i).each {|row| self.rows[row-1].height = row_heights[row] || 20}
|
272
|
+
end
|
273
|
+
|
274
|
+
def place_elements
|
275
|
+
self.blueprint.elements.each do |elem|
|
276
|
+
self.name_to_cell("#{column(elem.col)}#{elem.row}").value = elem.text
|
277
|
+
style = self.styles.add_style elem.combined_style
|
278
|
+
self.name_to_cell("#{column(elem.col)}#{elem.row}").style = style
|
279
|
+
self.add_comment ref: "#{column(elem.col)}#{elem.row}", text: "#{elem.comment}", author: elem.text, visible: false if elem.comment
|
280
|
+
self.merge_cells "#{column(elem.col)}#{elem.row}:#{column(elem.col+elem.merge)}#{elem.row}" if elem.merge
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
def set_max_row_and_column
|
285
|
+
self.blueprint.max = {col: 0, row: 0}
|
286
|
+
self.blueprint.max[:row] = self.blueprint.elements.max_by{|elem| elem.row}.row unless self.blueprint.elements.empty?
|
287
|
+
self.blueprint.max[:col] = self.blueprint.elements.max_by{|elem| elem.col}.col unless self.blueprint.elements.empty?
|
288
|
+
self.blueprint.max[:col] = self.blueprint.column_titles.count if self.blueprint.column_titles and self.blueprint.column_titles.count > self.blueprint.max[:col]
|
289
|
+
self.blueprint.max[:row] = self.blueprint.row_titles.count if self.blueprint.row_titles and self.blueprint.row_titles.count > self.blueprint.max[:row]
|
290
|
+
self.blueprint.max[:row] += self.blueprint.column_titles_start[0] if self.blueprint.column_titles_start
|
291
|
+
self.blueprint.max[:col] += self.blueprint.column_titles_start[1] if self.blueprint.column_titles_start
|
292
|
+
self.blueprint.max[:row] += self.blueprint.row_titles_start[0] if self.blueprint.row_titles_start
|
293
|
+
self.blueprint.max[:col] += self.blueprint.row_titles_start[1] if self.blueprint.row_titles_start
|
294
|
+
self.blueprint.max[:row] += self.blueprint.column_data.size if self.blueprint.column_data
|
295
|
+
self.blueprint.max[:col] += self.blueprint.row_data.size if self.blueprint.row_data
|
296
|
+
self.blueprint.max[:col] += self.blueprint.column_titles.select{|elem| elem.list}.size + self.blueprint.row_titles.select{|elem| elem.list}.size
|
297
|
+
(0..self.blueprint.max[:row]+1).each {self.add_row(Array.new(self.blueprint.max[:col].to_i, nil))}
|
298
|
+
end
|
299
|
+
|
300
|
+
def place_column_titles
|
301
|
+
self.blueprint.column_titles.each_with_index do |elem, index|
|
302
|
+
cell = self.name_to_cell("#{column(index+self.blueprint.column_titles_start[1]-1)}#{self.blueprint.column_titles_start[0]}")
|
303
|
+
cell.value = elem.text
|
304
|
+
style = self.styles.add_style elem.combined_style
|
305
|
+
cell.style = style
|
306
|
+
self.add_hyperlink location: elem.hyperlink, ref: cell if elem.hyperlink
|
307
|
+
self.add_comment ref: "#{column(index+self.blueprint.column_titles_start[1]-1)}#{self.blueprint.column_titles_start[0]}", text: "#{elem.comment}", author: elem.text, visible: false if elem.comment
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def set_lists_for_column_titles
|
312
|
+
existing_titles_with_lists = self.blueprint.column_titles.select{|elem| elem.list}
|
313
|
+
return false if existing_titles_with_lists.empty?
|
314
|
+
if lists_sheet = current_lists_sheet
|
315
|
+
pre_existing_titles_with_lists = []
|
316
|
+
lists_sheet.column_title_indexes.each do |title, column|
|
317
|
+
row = 2
|
318
|
+
list = []
|
319
|
+
while cell = lists_sheet.name_to_cell("#{column column}#{row}") and cell.value
|
320
|
+
list << cell.value
|
321
|
+
row += 1
|
322
|
+
end
|
323
|
+
pre_existing_titles_with_lists << Axlsx::Builder::Title.new(text: title, list: list)
|
324
|
+
end
|
325
|
+
titles_with_lists = pre_existing_titles_with_lists + existing_titles_with_lists
|
326
|
+
lists_sheet_index = self.workbook.worksheets.index {|sheet| sheet.name == 'Lists'}
|
327
|
+
self.workbook.worksheets.delete_at lists_sheet_index
|
328
|
+
else
|
329
|
+
titles_with_lists = existing_titles_with_lists
|
330
|
+
end
|
331
|
+
list_titles = []
|
332
|
+
list_data = []
|
333
|
+
titles_with_lists.each do |elem|
|
334
|
+
list_titles = titles_with_lists.map{|elem| {text: elem.text}}
|
335
|
+
elem.list.each {|list_item| list_data << {text: list_item, title: elem.text}}
|
336
|
+
end
|
337
|
+
list_titles.uniq!
|
338
|
+
list_data.uniq!
|
339
|
+
blueprint = Axlsx::Builder::Blueprint.new column_titles: list_titles
|
340
|
+
lists_sheet = self.workbook.add_worksheet name: 'Lists', blueprint: blueprint
|
341
|
+
lists_sheet.column_data= list_data
|
342
|
+
existing_titles_with_lists.each do |elem|
|
343
|
+
100.times do |row|
|
344
|
+
list_column = current_lists_sheet.column_title_indexes[elem.text]
|
345
|
+
self.add_data_validation("#{column (self.column_title_indexes[elem.text])}#{self.blueprint.column_titles_start[0]+row+1}", {
|
346
|
+
type: :list,
|
347
|
+
formula1: "Lists!#{column list_column}2:#{column list_column}#{elem.list.size+1}",
|
348
|
+
showDropDown: false,
|
349
|
+
showErrorMessage: true,
|
350
|
+
errorTitle: '',
|
351
|
+
errorStyle: :stop,
|
352
|
+
showInputMessage: true})
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
def place_row_titles
|
358
|
+
self.blueprint.row_titles.each_with_index do |elem, index|
|
359
|
+
cell = self.name_to_cell("#{column(self.blueprint.row_titles_start[1]-1)}#{self.blueprint.row_titles_start[0]+index}")
|
360
|
+
cell.value = elem.text
|
361
|
+
style = self.styles.add_style elem.combined_style
|
362
|
+
cell.style = style
|
363
|
+
self.add_hyperlink location: elem.hyperlink, ref: cell if elem.hyperlink
|
364
|
+
self.add_comment ref: "#{column(self.blueprint.row_titles_start[1]-1)}#{self.blueprint.row_titles_start[0]+index}", text: "#{elem.comment}", author: elem.text, visible: false if elem.comment
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
def set_lists_for_row_titles
|
369
|
+
existing_titles_with_lists = self.blueprint.row_titles.select{|elem| elem.list}
|
370
|
+
return false if existing_titles_with_lists.empty?
|
371
|
+
if lists_sheet = current_lists_sheet
|
372
|
+
pre_existing_titles_with_lists = []
|
373
|
+
lists_sheet.column_title_indexes.each do |title, column|
|
374
|
+
row = 2
|
375
|
+
list = []
|
376
|
+
while cell = lists_sheet.name_to_cell("#{column column}#{row}") and cell.value
|
377
|
+
list << cell.value
|
378
|
+
row += 1
|
379
|
+
end
|
380
|
+
pre_existing_titles_with_lists << Builder::Title.new(text: title, list: list)
|
381
|
+
end
|
382
|
+
titles_with_lists = pre_existing_titles_with_lists + existing_titles_with_lists
|
383
|
+
lists_sheet_index = self.workbook.worksheets.index {|sheet| sheet.name == 'Lists'}
|
384
|
+
self.workbook.worksheets.delete_at lists_sheet_index
|
385
|
+
else
|
386
|
+
titles_with_lists = existing_titles_with_lists
|
387
|
+
end
|
388
|
+
list_titles = []
|
389
|
+
list_data = []
|
390
|
+
titles_with_lists.each do |elem|
|
391
|
+
list_titles = titles_with_lists.map{|elem| {text: elem.text}}
|
392
|
+
elem.list.each {|list_item| list_data << {text: list_item, title: elem.text}}
|
393
|
+
end
|
394
|
+
list_titles.uniq!
|
395
|
+
list_data.uniq!
|
396
|
+
blueprint = Axlsx::Builder::Blueprint.new column_titles: list_titles
|
397
|
+
lists_sheet = self.workbook.add_worksheet name: 'Lists', blueprint: blueprint
|
398
|
+
lists_sheet.data column: list_data
|
399
|
+
existing_titles_with_lists.each do |elem|
|
400
|
+
100.times do |column|
|
401
|
+
list_column = current_lists_sheet.column_title_indexes[elem.text]
|
402
|
+
self.add_data_validation("#{column self.blueprint.row_titles_start[1]+column}#{self.row_title_indexes[elem.text]+1}", {
|
403
|
+
type: :list,
|
404
|
+
formula1: "Lists!#{column list_column}2:#{column list_column}#{elem.list.size+1}",
|
405
|
+
showDropDown: false,
|
406
|
+
showErrorMessage: true,
|
407
|
+
errorTitle: '',
|
408
|
+
errorStyle: :stop,
|
409
|
+
showInputMessage: true})
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
|
415
|
+
def set_column_title_row_height
|
416
|
+
return false if self.blueprint.column_titles.empty?
|
417
|
+
if self.blueprint.column_title_row_height
|
418
|
+
self.rows[self.blueprint.column_titles_start[0]-1].height = column_title_row_height
|
419
|
+
else
|
420
|
+
most_lines = self.blueprint.column_titles.max_by{|elem| elem.text.split("\n").size}.text.split("\n").size
|
421
|
+
self.rows[self.blueprint.column_titles_start[0]-1].height = most_lines * 10 + 10
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
def place_column_data
|
426
|
+
self.blueprint.column_data.each do |elem|
|
427
|
+
index = self.column_title_indexes[elem.title]
|
428
|
+
next unless index
|
429
|
+
title_column = column index
|
430
|
+
if elem.row
|
431
|
+
self.blueprint.name_to_cell("#{title_column}#{elem.row + self.blueprint.column_titles_start[0] + 1}").value = elem.text
|
432
|
+
else
|
433
|
+
row = self.blueprint.column_titles_start[0] + 1
|
434
|
+
while self.name_to_cell("#{title_column}#{row}").value
|
435
|
+
row += 1
|
436
|
+
end
|
437
|
+
self.name_to_cell("#{title_column}#{row}").value = elem.text
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
def place_row_data
|
443
|
+
self.blueprint.row_data.each do |elem|
|
444
|
+
title_row = self.row_title_indexes[elem.title]
|
445
|
+
column = self.blueprint.row_titles_start[1]
|
446
|
+
while self.name_to_cell("#{column column}#{title_row+1}").value
|
447
|
+
column += 1
|
448
|
+
end
|
449
|
+
self.name_to_cell("#{column column}#{title_row+1}").value = elem.text
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def move_lists_sheet_to_end
|
454
|
+
return false if self.name == 'Lists'
|
455
|
+
sheets = self.workbook.worksheets
|
456
|
+
lists_sheet_index = sheets.index { |sheet| sheet.name == 'Lists' }
|
457
|
+
if lists_sheet_index
|
458
|
+
lists_sheet = sheets[lists_sheet_index]
|
459
|
+
sheets.delete_at lists_sheet_index
|
460
|
+
sheets << lists_sheet
|
461
|
+
sheets.each_with_index {|sheet, index| sheet.workbook.worksheets[index] = sheet}
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
def column index
|
466
|
+
column = (index % 26 + 65).chr
|
467
|
+
column << (index / 26 + 64).chr if index > 25
|
468
|
+
column.reverse
|
469
|
+
end
|
470
|
+
|
471
|
+
def current_lists_sheet
|
472
|
+
self.workbook.sheet_by_name 'Lists'
|
473
|
+
end
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
def data column: nil, row: nil
|
478
|
+
self.column_data = column
|
479
|
+
self.row_data = row
|
480
|
+
self.build!
|
481
|
+
end
|
482
|
+
|
483
|
+
end
|
484
|
+
|
485
|
+
class Workbook
|
486
|
+
def add_worksheet(options={})
|
487
|
+
worksheet = Worksheet.new(self, options)
|
488
|
+
yield worksheet if block_given?
|
489
|
+
worksheet.build! if worksheet.blueprint
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
end
|
494
|
+
|
495
|
+
|
496
|
+
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: axlsx-builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MainShayne233
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: axlsx
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.1.pre
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1.pre
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- shaynetremblay@hotmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".idea/.rakeTasks"
|
78
|
+
- ".idea/axlsx-builder.iml"
|
79
|
+
- ".idea/misc.xml"
|
80
|
+
- ".idea/modules.xml"
|
81
|
+
- ".idea/vcs.xml"
|
82
|
+
- ".idea/workspace.xml"
|
83
|
+
- ".rspec"
|
84
|
+
- ".travis.yml"
|
85
|
+
- CODE_OF_CONDUCT.md
|
86
|
+
- Gemfile
|
87
|
+
- LICENSE.txt
|
88
|
+
- README.md
|
89
|
+
- Rakefile
|
90
|
+
- axlsx-builder.gemspec
|
91
|
+
- bin/console
|
92
|
+
- bin/setup
|
93
|
+
- lib/axlsx/builder.rb
|
94
|
+
- lib/axlsx/builder/version.rb
|
95
|
+
homepage: https://github.com/MainShayne233/axlsx-builder
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.5.1
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: An extension of Axlsx that allows you create spreadsheets blueprints for
|
119
|
+
easy sheet generation, manipulation, and data input.
|
120
|
+
test_files: []
|