docx 0.2.0 → 0.2.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -0
- data/README.md +30 -11
- data/lib/docx/version.rb +1 -1
- metadata +36 -5
- metadata.gz.sig +2 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjc5ZDY4NzcyOGE5ZWUzZWMxZGI4ODFjMmFkOWRhNGY1YzNkMDM3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2I0ZjZlMjUxMjI5ZmQ4NTUwZThmY2FkNTkxYTQzYzdlNzZiMTg3Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmFjYWIxZDYzMmFhOTVkNDEyZTQ1NjI2Zjc1NmUyNzZhYTc4YTVjNTM2OTM5
|
10
|
+
OTVlZWZlMDc5YTdmMDIwY2JhMzY5ZDY4NGQ4YTY1NTc1NjhlZDMwYTljNDAy
|
11
|
+
NDljMjc3YTEzNWNmMjNiNjUzZjI4ZmQ5ZjYxYmMwMDNmYjQzNTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTVmMmM1ZDAyYWVkNjdjMDZmMDFjMjkwMTliNDllNWZjOWUyZGI5MWYyYjUz
|
14
|
+
ODdkMWRjNDAwYTgwNTg1MmNhN2ViNDYzNjI2MGM3NzE2NGQyMjUxMjBhZDdm
|
15
|
+
OTJiYzlhZjU3MWU5YjNhMDBkMzg2ZjNlZjg2MzM1OGM1MzNjNjQ=
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
��"��'�8�~�K�M9f{�.��Uߍ+e���tqIkrL2a�GH�1���ByO ܟ�������e�����-FV�*��)yv�C$T����<Ʉ�λ�%z."���\i��'z�K��L*
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# docx
|
2
2
|
|
3
|
-
a ruby library/gem for interacting with `.docx` files
|
3
|
+
a ruby library/gem for interacting with `.docx` files. currently capabilities include reading paragraphs/bookmarks, inserting text at bookmarks, and saving the document.
|
4
4
|
|
5
5
|
## usage
|
6
6
|
|
@@ -10,15 +10,33 @@ requires ruby (only tested with 1.9.3 so far)
|
|
10
10
|
|
11
11
|
gem install docx
|
12
12
|
|
13
|
-
###
|
13
|
+
### reading
|
14
14
|
|
15
15
|
``` ruby
|
16
16
|
require 'docx'
|
17
17
|
|
18
18
|
d = Docx::Document.open('example.docx')
|
19
|
-
|
19
|
+
# Array of paragraphs
|
20
|
+
d.paragraphs.each do |p|
|
20
21
|
puts d
|
21
22
|
end
|
23
|
+
|
24
|
+
# Hash of Bookmarks. Bookmark names as keys correspond to bookmark objects.
|
25
|
+
d.bookmarks.each_pair do |bookmark_name, bookmark_object|
|
26
|
+
puts bookmark_name
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
### writing
|
31
|
+
|
32
|
+
``` ruby
|
33
|
+
require 'docx'
|
34
|
+
|
35
|
+
d = Docx::Document.open('example.docx')
|
36
|
+
# Insert a single line after a bookmark
|
37
|
+
d.bookmarks['example_bookmark'].insert_after("Hello world.")
|
38
|
+
# Each value in array is put on a separate line
|
39
|
+
d.bookmarks['example_bookmark'].insert_multiple_lines_after(['Hello', 'World', 'foo'])
|
22
40
|
```
|
23
41
|
|
24
42
|
### advanced
|
@@ -27,15 +45,16 @@ end
|
|
27
45
|
require 'docx'
|
28
46
|
|
29
47
|
d = Docx::Document.open('example.docx')
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
run.underlined?
|
35
|
-
run.formatting
|
36
|
-
run.text
|
37
|
-
end
|
48
|
+
|
49
|
+
# The Nokogiri node on which an element is based can be accessed using #node
|
50
|
+
d.paragraphs.each do |p|
|
51
|
+
puts p.node.inspect
|
38
52
|
end
|
53
|
+
|
54
|
+
# The #xpath and #at_xpath are delegated to the node from the element, saving a step
|
55
|
+
p_element = d.paragraphs.first
|
56
|
+
p_children = p_element.xpath("//child::*") # selects all children
|
57
|
+
p_child = p_element.at_xpath("//child::*") # selects first child
|
39
58
|
```
|
40
59
|
|
41
60
|
## Development
|
data/lib/docx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.01
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Christopher Hunt
|
7
8
|
- Marcus Ortiz
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURjRENDQWxpZ0F3SUJB
|
14
|
+
Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREEvTVJFd0R3WURWUVFEREFoamFI
|
15
|
+
SmgKYUhWdWRERVZNQk1HQ2dtU0pvbVQ4aXhrQVJrV0JXZHRZV2xzTVJNd0VR
|
16
|
+
WUtDWkltaVpQeUxHUUJHUllEWTI5dApNQjRYRFRFek1EUXhOVEl3TURFeU4x
|
17
|
+
b1hEVEUwTURReE5USXdNREV5TjFvd1B6RVJNQThHQTFVRUF3d0lZMmh5CllX
|
18
|
+
aDFiblF4RlRBVEJnb0praWFKay9Jc1pBRVpGZ1ZuYldGcGJERVRNQkVHQ2dt
|
19
|
+
U0pvbVQ4aXhrQVJrV0EyTnYKYlRDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFB
|
20
|
+
RGdnRVBBRENDQVFvQ2dnRUJBTFhycTdlWHRQaT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K09TZ2dySitJQkYzTGYr
|
36
|
+
VjNzSHhiNkxHV0h4ekNNMHpIdU5OWEJsQTdnRWQyNFAKQ0llcEtTdnlwQUdP
|
37
|
+
ckhRbGdpOTNPbkxEWjdKa3pCMk1wcDA0em5NSllQOGZIdGJCTkE2bFUxL2tK
|
38
|
+
NEV0UFhmRQpLdFE1SGpuNFVDNTg0R0pyR01haFVnbXhMbmZleXVZWXVZTlFF
|
39
|
+
M1VzVlVQYXl6eGtQVW9DOFZzT0orV1ZmMnMrCkcxL1VkNGRVYkVtOGdRL2J4
|
40
|
+
bDM1TzBBdkhCcz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
|
41
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
12
42
|
dependencies:
|
13
43
|
- !ruby/object:Gem::Dependency
|
14
44
|
name: nokogiri
|
@@ -39,7 +69,8 @@ dependencies:
|
|
39
69
|
- !ruby/object:Gem::Version
|
40
70
|
version: '0.9'
|
41
71
|
description: a ruby library/gem for interacting with .docx files
|
42
|
-
email:
|
72
|
+
email:
|
73
|
+
- chrahunt@gmail.com
|
43
74
|
executables: []
|
44
75
|
extensions: []
|
45
76
|
extra_rdoc_files: []
|
@@ -60,7 +91,7 @@ files:
|
|
60
91
|
- lib/docx/test.rb
|
61
92
|
- lib/docx/version.rb
|
62
93
|
- lib/docx.rb
|
63
|
-
homepage: https://github.com/
|
94
|
+
homepage: https://github.com/chrahunt/docx
|
64
95
|
licenses: []
|
65
96
|
metadata: {}
|
66
97
|
post_install_message:
|
metadata.gz.sig
ADDED