Hello World in Ruby
Contents
[
Hide
]
Aspose.Words - Hello World
To Write anything in the Word Document using Aspose.Words for Java in Ruby, simply invoke print_hello_world() method of HelloWorld module.
Ruby Code
data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/quickstart/'
### a blank document.
document = Rjb::import('com.aspose.words.Document').new()
#### provides members to easily add content to a document.
builder = Rjb::import('com.aspose.words.DocumentBuilder').new(document)
##### a new paragraph in the document with the text "Hello World!"
builder.writeln("Hello World!")
\# Save the document in DOCX format. The format to save as is inferred from the extension of the file name.
\# Aspose.Words supports saving any document in many more formats.
document.save(data_dir + "HelloWorld.docx")
Download Running Code
Download Hello World (Aspose.Words) from any of the below mentioned social coding sites: