asposewordsjavaforruby 0.0.4 → 0.0.5

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/Gempackage +2 -2
  3. data/LICENSE +20 -20
  4. data/README.md +28 -2
  5. data/Rakefile +2 -2
  6. data/asposewordsjavaforruby.gemspec +27 -27
  7. data/config/aspose.yml +5 -5
  8. data/data/LoadTxt.txt +14 -14
  9. data/lib/asposewordsjavaforruby.rb +71 -71
  10. data/lib/asposewordsjavaforruby/addwatermark.rb +84 -84
  11. data/lib/asposewordsjavaforruby/appenddoc.rb +24 -24
  12. data/lib/asposewordsjavaforruby/appenddocument.rb +229 -229
  13. data/lib/asposewordsjavaforruby/applylicense.rb +16 -16
  14. data/lib/asposewordsjavaforruby/asposewordsjava.rb +23 -23
  15. data/lib/asposewordsjavaforruby/autofittables.rb +123 -123
  16. data/lib/asposewordsjavaforruby/bookmarks.rb +132 -132
  17. data/lib/asposewordsjavaforruby/checkformat.rb +70 -70
  18. data/lib/asposewordsjavaforruby/compressimages.rb +53 -53
  19. data/lib/asposewordsjavaforruby/doc2pdf.rb +15 -15
  20. data/lib/asposewordsjavaforruby/doctohtml.rb +26 -26
  21. data/lib/asposewordsjavaforruby/extractcontent.rb +395 -395
  22. data/lib/asposewordsjavaforruby/findandreplace.rb +29 -29
  23. data/lib/asposewordsjavaforruby/helloworld.rb +26 -26
  24. data/lib/asposewordsjavaforruby/imagetopdf.rb +71 -71
  25. data/lib/asposewordsjavaforruby/insertnestedfields.rb +39 -39
  26. data/lib/asposewordsjavaforruby/loadandsavetodisk.rb +20 -20
  27. data/lib/asposewordsjavaforruby/loadandsavetostream.rb +32 -32
  28. data/lib/asposewordsjavaforruby/loadtxt.rb +14 -14
  29. data/lib/asposewordsjavaforruby/mergefield.rb +45 -45
  30. data/lib/asposewordsjavaforruby/nodes.rb +29 -29
  31. data/lib/asposewordsjavaforruby/processcomments.rb +72 -72
  32. data/lib/asposewordsjavaforruby/removebreaks.rb +65 -65
  33. data/lib/asposewordsjavaforruby/removefield.rb +23 -23
  34. data/lib/asposewordsjavaforruby/saveasmultipagetiff.rb +26 -26
  35. data/lib/asposewordsjavaforruby/simplemailmerge.rb +23 -23
  36. data/lib/asposewordsjavaforruby/styles.rb +77 -77
  37. data/lib/asposewordsjavaforruby/updatefields.rb +62 -62
  38. data/lib/asposewordsjavaforruby/version.rb +3 -3
  39. metadata +18 -28
@@ -1,26 +1,26 @@
1
- module Asposewordsjavaforruby
2
- module SaveAsMultipageTiff
3
- def initialize()
4
- # The path to the documents directory.
5
- data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
6
-
7
- # Open the document.
8
- doc = Rjb::import('com.aspose.words.Document').new(data_dir + "TestFile.doc")
9
-
10
- # Save the document as multipage TIFF.
11
- doc.save(data_dir + "TestFile Out.doc")
12
-
13
- save_format = Rjb::import('com.aspose.words.SaveFormat')
14
-
15
- options = Rjb::import('com.aspose.words.ImageSaveOptions').new(save_format.TIFF)
16
- options.setPageIndex(0)
17
- options.setPageCount(2)
18
-
19
- tiff_compression = Rjb::import('com.aspose.words.TiffCompression')
20
- options.setTiffCompression(tiff_compression.CCITT_4)
21
- options.setResolution(160)
22
-
23
- doc.save(data_dir + "TestFileWithOptions Out.tiff", options)
24
- end
25
- end
26
- end
1
+ module Asposewordsjavaforruby
2
+ module SaveAsMultipageTiff
3
+ def initialize()
4
+ # The path to the documents directory.
5
+ data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
6
+
7
+ # Open the document.
8
+ doc = Rjb::import('com.aspose.words.Document').new(data_dir + "TestFile.doc")
9
+
10
+ # Save the document as multipage TIFF.
11
+ doc.save(data_dir + "TestFile Out.doc")
12
+
13
+ save_format = Rjb::import('com.aspose.words.SaveFormat')
14
+
15
+ options = Rjb::import('com.aspose.words.ImageSaveOptions').new(save_format.TIFF)
16
+ options.setPageIndex(0)
17
+ options.setPageCount(2)
18
+
19
+ tiff_compression = Rjb::import('com.aspose.words.TiffCompression')
20
+ options.setTiffCompression(tiff_compression.CCITT_4)
21
+ options.setResolution(160)
22
+
23
+ doc.save(data_dir + "TestFileWithOptions Out.tiff", options)
24
+ end
25
+ end
26
+ end
@@ -1,23 +1,23 @@
1
- module Asposewordsjavaforruby
2
- module SimpleMailMerge
3
- def initialize()
4
- mail_merge()
5
- end
6
-
7
- def mail_merge()
8
- # The path to the documents directory.
9
- data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/quickstart/'
10
-
11
- # Open the document.
12
- doc = Rjb::import('com.aspose.words.Document').new(data_dir + "MailMerge.doc")
13
- # Fill the fields in the document with user data.
14
- doc.getMailMerge().execute(
15
- Array["FullName", "Company", "Address", "Address2", "City"],
16
- Array["James Bond", "MI5 Headquarters", "Milbank", "", "London"]
17
- )
18
- # Saves the document to disk.
19
- doc.save(data_dir + "MailMerge Out.docx")
20
- end
21
-
22
- end
23
- end
1
+ module Asposewordsjavaforruby
2
+ module SimpleMailMerge
3
+ def initialize()
4
+ mail_merge()
5
+ end
6
+
7
+ def mail_merge()
8
+ # The path to the documents directory.
9
+ data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/quickstart/'
10
+
11
+ # Open the document.
12
+ doc = Rjb::import('com.aspose.words.Document').new(data_dir + "MailMerge.doc")
13
+ # Fill the fields in the document with user data.
14
+ doc.getMailMerge().execute(
15
+ Array["FullName", "Company", "Address", "Address2", "City"],
16
+ Array["James Bond", "MI5 Headquarters", "Milbank", "", "London"]
17
+ )
18
+ # Saves the document to disk.
19
+ doc.save(data_dir + "MailMerge Out.docx")
20
+ end
21
+
22
+ end
23
+ end
@@ -1,77 +1,77 @@
1
- module Asposewordsjavaforruby
2
- module ExtractContentBasedOnStyles
3
- def initialize()
4
- # The path to the documents directory.
5
- data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
6
-
7
- # Open the document.
8
- doc = Rjb::import('com.aspose.words.Document').new(data_dir + "Test.Styles.doc")
9
-
10
- # Define style names as they are specified in the Word document.
11
- para_style = "Heading 1"
12
- run_style = "Intense Emphasis"
13
-
14
- # Collect paragraphs with defined styles.
15
- # Show the number of collected paragraphs and display the text of this paragraphs.
16
- paragraphs = paragraphs_by_style_name(doc, para_style)
17
- para_size = paragraphs.size()
18
- #para_size = java_values($para_size)
19
- puts "Paragraphs with #{para_style} styles #{para_size}"
20
-
21
- paragraphs = paragraphs.toArray()
22
- save_format = Rjb::import("com.aspose.words.SaveFormat")
23
-
24
- paragraphs.each do |paragraph|
25
- puts paragraph.toString(save_format.TEXT)
26
- end
27
-
28
- # Collect runs with defined styles.
29
- # Show the number of collected runs and display the text of this runs.
30
- runs = runs_by_style_name(doc, run_style)
31
- runs_size = runs.size()
32
-
33
- puts "Runs with #{run_style} styles #{runs_size}"
34
- runs = runs.toArray()
35
- runs.each do |run|
36
- puts run.getRange().getText()
37
- end
38
- end
39
-
40
- def paragraphs_by_style_name(doc, para_style)
41
- # Create an array to collect paragraphs of the specified style.
42
- paragraphsWithStyle = Rjb::import("java.util.ArrayList").new
43
- # Get all paragraphs from the document.
44
- nodeType = Rjb::import("com.aspose.words.NodeType")
45
- paragraphs = doc.getChildNodes(nodeType.PARAGRAPH, true)
46
- paragraphs = paragraphs.toArray()
47
-
48
- # Look through all paragraphs to find those with the specified style.
49
- paragraphs.each do |paragraph|
50
- para_name = paragraph.getParagraphFormat().getStyle().getName()
51
- if (para_name == para_style) then
52
- paragraphsWithStyle.add(paragraph)
53
- end
54
- end
55
- paragraphsWithStyle
56
- end
57
-
58
- def runs_by_style_name(doc, run_style)
59
- # Create an array to collect runs of the specified style.
60
- runsWithStyle = Rjb::import("java.util.ArrayList").new
61
-
62
- # Get all runs from the document.
63
- nodeType = Rjb::import("com.aspose.words.NodeType")
64
- runs = doc.getChildNodes(nodeType.RUN, true)
65
-
66
- # Look through all runs to find those with the specified style.
67
- runs = runs.toArray()
68
- runs.each do |run|
69
- if (run.getFont().getStyle().getName() == run_style) then
70
- runsWithStyle.add(run)
71
- end
72
- end
73
- runsWithStyle
74
- end
75
-
76
- end
77
- end
1
+ module Asposewordsjavaforruby
2
+ module ExtractContentBasedOnStyles
3
+ def initialize()
4
+ # The path to the documents directory.
5
+ data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
6
+
7
+ # Open the document.
8
+ doc = Rjb::import('com.aspose.words.Document').new(data_dir + "Test.Styles.doc")
9
+
10
+ # Define style names as they are specified in the Word document.
11
+ para_style = "Heading 1"
12
+ run_style = "Intense Emphasis"
13
+
14
+ # Collect paragraphs with defined styles.
15
+ # Show the number of collected paragraphs and display the text of this paragraphs.
16
+ paragraphs = paragraphs_by_style_name(doc, para_style)
17
+ para_size = paragraphs.size()
18
+ #para_size = java_values($para_size)
19
+ puts "Paragraphs with #{para_style} styles #{para_size}"
20
+
21
+ paragraphs = paragraphs.toArray()
22
+ save_format = Rjb::import("com.aspose.words.SaveFormat")
23
+
24
+ paragraphs.each do |paragraph|
25
+ puts paragraph.toString(save_format.TEXT)
26
+ end
27
+
28
+ # Collect runs with defined styles.
29
+ # Show the number of collected runs and display the text of this runs.
30
+ runs = runs_by_style_name(doc, run_style)
31
+ runs_size = runs.size()
32
+
33
+ puts "Runs with #{run_style} styles #{runs_size}"
34
+ runs = runs.toArray()
35
+ runs.each do |run|
36
+ puts run.getRange().getText()
37
+ end
38
+ end
39
+
40
+ def paragraphs_by_style_name(doc, para_style)
41
+ # Create an array to collect paragraphs of the specified style.
42
+ paragraphsWithStyle = Rjb::import("java.util.ArrayList").new
43
+ # Get all paragraphs from the document.
44
+ nodeType = Rjb::import("com.aspose.words.NodeType")
45
+ paragraphs = doc.getChildNodes(nodeType.PARAGRAPH, true)
46
+ paragraphs = paragraphs.toArray()
47
+
48
+ # Look through all paragraphs to find those with the specified style.
49
+ paragraphs.each do |paragraph|
50
+ para_name = paragraph.getParagraphFormat().getStyle().getName()
51
+ if (para_name == para_style) then
52
+ paragraphsWithStyle.add(paragraph)
53
+ end
54
+ end
55
+ paragraphsWithStyle
56
+ end
57
+
58
+ def runs_by_style_name(doc, run_style)
59
+ # Create an array to collect runs of the specified style.
60
+ runsWithStyle = Rjb::import("java.util.ArrayList").new
61
+
62
+ # Get all runs from the document.
63
+ nodeType = Rjb::import("com.aspose.words.NodeType")
64
+ runs = doc.getChildNodes(nodeType.RUN, true)
65
+
66
+ # Look through all runs to find those with the specified style.
67
+ runs = runs.toArray()
68
+ runs.each do |run|
69
+ if (run.getFont().getStyle().getName() == run_style) then
70
+ runsWithStyle.add(run)
71
+ end
72
+ end
73
+ runsWithStyle
74
+ end
75
+
76
+ end
77
+ end
@@ -1,62 +1,62 @@
1
- module Asposewordsjavaforruby
2
- module UpdateFields
3
- def initialize()
4
- update_fields()
5
- end
6
-
7
- def update_fields()
8
- # The path to the documents directory.
9
- data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/quickstart/'
10
-
11
- # Demonstrates how to insert fields and update them using Aspose.Words.
12
- # First create a blank document.
13
- doc = Rjb::import('com.aspose.words.Document').new()
14
- # Use the document builder to insert some content and fields.
15
- builder = Rjb::import('com.aspose.words.DocumentBuilder').new(doc)
16
- # Insert a table of contents at the beginning of the document.
17
- builder.insertTableOfContents("\\o \"1-3\" \\h \\z \\u")
18
- builder.writeln()
19
- # Insert some other fields.
20
- builder.write("Page: ")
21
- builder.insertField("PAGE")
22
- builder.write(" of ")
23
- builder.insertField("NUMPAGES")
24
- builder.writeln()
25
- builder.write("Date: ")
26
- builder.insertField("DATE")
27
-
28
- # Start the actual document content on the second page.
29
- break_type = Rjb::import("com.aspose.words.BreakType")
30
- builder.insertBreak(break_type.SECTION_BREAK_NEW_PAGE)
31
-
32
- # Build a document with complex structure by applying different heading styles thus creating TOC entries.
33
- style_identifier = Rjb::import("com.aspose.words.StyleIdentifier")
34
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_1)
35
- builder.writeln("Heading 1")
36
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
37
- builder.writeln("Heading 1.1")
38
- builder.writeln("Heading 1.2")
39
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_1)
40
- builder.writeln("Heading 2")
41
- builder.writeln("Heading 3")
42
-
43
- # Move to the next page.
44
- builder.insertBreak(break_type.PAGE_BREAK)
45
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
46
- builder.writeln("Heading 3.1")
47
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_3)
48
- builder.writeln("Heading 3.1.1")
49
- builder.writeln("Heading 3.1.2")
50
- builder.writeln("Heading 3.1.3")
51
- builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
52
- builder.writeln("Heading 3.2")
53
- builder.writeln("Heading 3.3")
54
- puts "Updating all fields in the document."
55
-
56
- # Call the method below to update the TOC.
57
- doc.updateFields()
58
- doc.save(data_dir + "Document Field Update Out.docx")
59
- end
60
-
61
- end
62
- end
1
+ module Asposewordsjavaforruby
2
+ module UpdateFields
3
+ def initialize()
4
+ update_fields()
5
+ end
6
+
7
+ def update_fields()
8
+ # The path to the documents directory.
9
+ data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/quickstart/'
10
+
11
+ # Demonstrates how to insert fields and update them using Aspose.Words.
12
+ # First create a blank document.
13
+ doc = Rjb::import('com.aspose.words.Document').new()
14
+ # Use the document builder to insert some content and fields.
15
+ builder = Rjb::import('com.aspose.words.DocumentBuilder').new(doc)
16
+ # Insert a table of contents at the beginning of the document.
17
+ builder.insertTableOfContents("\\o \"1-3\" \\h \\z \\u")
18
+ builder.writeln()
19
+ # Insert some other fields.
20
+ builder.write("Page: ")
21
+ builder.insertField("PAGE")
22
+ builder.write(" of ")
23
+ builder.insertField("NUMPAGES")
24
+ builder.writeln()
25
+ builder.write("Date: ")
26
+ builder.insertField("DATE")
27
+
28
+ # Start the actual document content on the second page.
29
+ break_type = Rjb::import("com.aspose.words.BreakType")
30
+ builder.insertBreak(break_type.SECTION_BREAK_NEW_PAGE)
31
+
32
+ # Build a document with complex structure by applying different heading styles thus creating TOC entries.
33
+ style_identifier = Rjb::import("com.aspose.words.StyleIdentifier")
34
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_1)
35
+ builder.writeln("Heading 1")
36
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
37
+ builder.writeln("Heading 1.1")
38
+ builder.writeln("Heading 1.2")
39
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_1)
40
+ builder.writeln("Heading 2")
41
+ builder.writeln("Heading 3")
42
+
43
+ # Move to the next page.
44
+ builder.insertBreak(break_type.PAGE_BREAK)
45
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
46
+ builder.writeln("Heading 3.1")
47
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_3)
48
+ builder.writeln("Heading 3.1.1")
49
+ builder.writeln("Heading 3.1.2")
50
+ builder.writeln("Heading 3.1.3")
51
+ builder.getParagraphFormat().setStyleIdentifier(style_identifier.HEADING_2)
52
+ builder.writeln("Heading 3.2")
53
+ builder.writeln("Heading 3.3")
54
+ puts "Updating all fields in the document."
55
+
56
+ # Call the method below to update the TOC.
57
+ doc.updateFields()
58
+ doc.save(data_dir + "Document Field Update Out.docx")
59
+ end
60
+
61
+ end
62
+ end
@@ -1,3 +1,3 @@
1
- module Asposewordsjavaforruby
2
- VERSION = '0.0.4'
3
- end
1
+ module Asposewordsjavaforruby
2
+ VERSION = '0.0.5'
3
+ end
metadata CHANGED
@@ -1,82 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asposewordsjavaforruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Aspose Marketplace
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-06-23 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.7'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.7'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '10.0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '10.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rjb
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: 1.5.3
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.5.3
78
- description: AsposeWordsJavaforRuby is a Ruby gem that can help working with aspose.words
79
- libraries
69
+ description: AsposeWordsJavaforRuby is a Ruby gem that helps working with Microsoft
70
+ Word and OpenOffice documents using Aspose.Words for Java libraries
80
71
  email:
81
72
  - marketplace@aspose.com
82
73
  executables: []
@@ -146,29 +137,28 @@ files:
146
137
  - lib/asposewordsjavaforruby/styles.rb
147
138
  - lib/asposewordsjavaforruby/updatefields.rb
148
139
  - lib/asposewordsjavaforruby/version.rb
149
- homepage: https://github.com/asposemarketplace/Aspose_Words_Java_for_Ruby
140
+ homepage: https://github.com/asposewords/Aspose_Words_Java/tree/master/Plugins/Aspose_Words_Java_for_Ruby
150
141
  licenses:
151
142
  - MIT
143
+ metadata: {}
152
144
  post_install_message:
153
145
  rdoc_options: []
154
146
  require_paths:
155
147
  - lib
156
148
  required_ruby_version: !ruby/object:Gem::Requirement
157
- none: false
158
149
  requirements:
159
- - - ! '>='
150
+ - - ">="
160
151
  - !ruby/object:Gem::Version
161
152
  version: '0'
162
153
  required_rubygems_version: !ruby/object:Gem::Requirement
163
- none: false
164
154
  requirements:
165
- - - ! '>='
155
+ - - ">="
166
156
  - !ruby/object:Gem::Version
167
157
  version: '0'
168
158
  requirements: []
169
159
  rubyforge_project:
170
- rubygems_version: 1.8.30
160
+ rubygems_version: 2.4.5
171
161
  signing_key:
172
- specification_version: 3
162
+ specification_version: 4
173
163
  summary: A Ruby gem to work with aspose.words libraries
174
164
  test_files: []