Last active
July 28, 2017 12:52
-
-
Save aspose-words/d7482a8f2824fb669f7c31d8518ad13e to your computer and use it in GitHub Desktop.
The GIST contains Ruby code snippets for examples of Aspose.Words for Cloud.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose.Words-for-Cloud-for-Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Bookmarks | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document bookmark data by its name. | |
def read_document_bookmark_data_by_its_name | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
bookmark_name = "aspose" | |
response = @words_api.get_document_bookmark_by_name(file_name, bookmark_name) | |
end | |
end | |
bookmarks = Bookmarks.new() | |
puts bookmarks.read_document_bookmark_data_by_its_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Bookmarks | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document bookmarks common info. | |
def read_document_bookmarks_common_info | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_bookmarks(file_name) | |
end | |
end | |
bookmarks = Bookmarks.new() | |
puts bookmarks.read_document_bookmarks_common_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Bookmarks | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Update document bookmark. | |
def update_document_bookmark | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
bookmark_data = BookmarkData.new | |
bookmark_data.name = "aspose" | |
bookmark_data.text = "Aspose APIs" | |
bookmark_name = "aspose" | |
response = @words_api.post_update_document_bookmark(file_name, bookmark_name, bookmark_data) | |
end | |
end | |
bookmarks = Bookmarks.new() | |
puts bookmarks.update_document_bookmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Comments | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_comments_from_document | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_comments(file_name) | |
end | |
end | |
comments = Comments.new() | |
puts comments.get_comments_from_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def accept_all_revisions_in_document | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.accept_all_revisions(file_name) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.accept_all_revisions_in_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def append_a_document | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
append_doc_1_file_name = "SampleAppendDoc.docx" | |
upload_file(append_doc_1_file_name) | |
append_doc_2_file_name = "SampleAppendDoc2.docx" | |
upload_file(append_doc_2_file_name) | |
document_1 = DocumentEntry.new | |
document_1.href = append_doc_1_file_name | |
document_1.import_format_mode = "KeepSourceFormatting" | |
document_2 = DocumentEntry.new | |
document_2.href = append_doc_2_file_name | |
document_2.import_format_mode = "KeepSourceFormatting" | |
document_list = DocumentEntryList.new | |
document_list.document_entries = [document_1, document_2] | |
response = @words_api.post_append_document(file_name, document_list) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.append_a_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Convert document from request content to format specified. | |
def convert_document_from_request_content | |
file_name = "SampleWordDocument.docx" | |
convert_to_format = "pdf" | |
response = @words_api.put_convert_document(File.open("../../../data/" << file_name,"r") { |io| io.read }, {format: convert_to_format}) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.convert_document_from_request_content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Convert document to destination format with detailed settings and save result to storage. | |
def convert_document_to_destination_format | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
save_options = SaveOptionsData.new | |
save_options.save_format = "pdf" | |
save_options.file_name = "SampleWordDocument.pdf" | |
response = @words_api.post_document_save_as(file_name, save_options) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.convert_document_to_destination_format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Load new document from web into the file with any supported format of data. | |
def load_web_document | |
load_web_document_data = LoadWebDocumentData.new | |
load_web_document_data.loading_document_url = "http://google.com" | |
save_options = SaveOptionsData.new | |
save_options.save_format = "doc" | |
save_options.file_name = "google.doc" | |
load_web_document_data.save_options = save_options | |
response = @words_api.post_load_web_document(load_web_document_data) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.load_web_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def read_document_statistics | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_statistics(file_name, {include_comments: true, include_footnotes: true, include_text_in_shapes: true}) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.read_document_statistics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def reject_all_revisions | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.reject_all_revisions(file_name) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.reject_all_revisions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocument | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def render_page | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
page_index = 1 | |
format = "bmp" | |
response = @words_api.render_page(file_name, page_index, format, opts = {}) | |
end | |
end | |
workingWithDocument = WorkingWithDocument.new() | |
puts workingWithDocument.render_page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocumentProperties | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def delete_document_property | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
property_name = "AsposeAuthor" | |
response = @words_api.delete_document_property(file_name, property_name) | |
end | |
end | |
workingWithDocumentProperties = WorkingWithDocumentProperties.new() | |
puts workingWithDocumentProperties.delete_document_property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocumentProperties | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document properties info. | |
def read_document_properties_info | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_properties(file_name) | |
end | |
end | |
workingWithDocumentProperties = WorkingWithDocumentProperties.new() | |
puts workingWithDocumentProperties.read_document_properties_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocumentProperties | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def read_document_property_info_by_the_property_name | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
property_name = "Author" | |
response = @words_api.get_document_property(file_name, property_name) | |
end | |
end | |
workingWithDocumentProperties = WorkingWithDocumentProperties.new() | |
puts workingWithDocumentProperties.read_document_property_info_by_the_property_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithDocumentProperties | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def add_new_or_update_existing_document_property | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
property = DocumentProperty.new | |
property.name = "Provider" | |
property.value = "Jobs" | |
property_name = "Provider" | |
response = @words_api.put_update_document_property(file_name, property_name, property) | |
end | |
end | |
workingWithDocumentProperties = WorkingWithDocumentProperties.new() | |
puts workingWithDocumentProperties.add_new_or_update_existing_document_property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class DrawingObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get drawing object OLE data. | |
def get_drawing_object_ole_data | |
file_name = "Sample_EmbeddedOLE.docx" | |
upload_file(file_name) | |
object_index = 0 | |
response = @words_api.get_document_drawing_object_ole_data(file_name, object_index) | |
end | |
end | |
drawingObjects = DrawingObjects.new() | |
puts drawingObjects.get_drawing_object_ole_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class DrawingObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document drawing objects common info. | |
def read_document_drawing_objects_common_info | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_drawing_objects(file_name) | |
end | |
end | |
drawingObjects = DrawingObjects.new() | |
puts drawingObjects.read_document_drawing_objects_common_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class DrawingObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read drawing object image data. | |
def read_drawing_object_image_data | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
object_index = 2 | |
response = @words_api.get_document_drawing_object_image_data(file_name, object_index) | |
end | |
end | |
drawingObjects = DrawingObjects.new() | |
puts drawingObjects.read_drawing_object_image_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Fields | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Add form field to paragraph, returns added form field's data. | |
def add_form_field_to_paragraph | |
file_name = "FormFilled.docx" | |
upload_file(file_name) | |
form_field = FormField.new | |
form_field.name = "FullName" | |
form_field.status_text = "Enter your name and surname (trimmed to 30 characters)" | |
form_field.enabled = true | |
section_index = 0 | |
paragraph_index = 0 | |
response = @words_api.put_form_field(file_name, section_index, paragraph_index, form_field) | |
end | |
end | |
fields = Fields.new() | |
puts fields.add_form_field_to_paragraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Fields | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Insert document page numbers. | |
def insert_document_page_numbers | |
file_name = "SampleWordDocument.docx" | |
#upload_file(file_name) | |
page_number = PageNumber.new | |
page_number.format = "{PAGE} of {NUMPAGES}" | |
page_number.alignment = "center" | |
response = @words_api.post_insert_page_numbers(file_name, page_number) | |
end | |
end | |
fields = Fields.new() | |
puts fields.insert_document_page_numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Fields | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document field names. | |
def read_document_field_names | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_field_names(file_name) | |
end | |
end | |
fields = Fields.new() | |
puts fields.read_document_field_names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithFields | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Update (reevaluate) fields in document. | |
def update_document_fields | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.post_update_document_fields(file_name) | |
end | |
end | |
workingWithFields = WorkingWithFields.new() | |
puts workingWithFields.update_document_fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Hyperlinks | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document hyperlink by its index. | |
def read_document_hyperlink_by_index | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
hyperlink_index = 0 | |
response = @words_api.get_document_hyperlink_by_index(file_name, hyperlink_index) | |
end | |
end | |
hyperlinks = Hyperlinks.new() | |
puts hyperlinks.read_document_hyperlink_by_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Hyperlinks | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document hyperlinks common info. | |
def read_document_hyperlinks_common_info | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_hyperlinks(file_name) | |
end | |
end | |
hyperlinks = Hyperlinks.new() | |
puts hyperlinks.read_document_hyperlinks_common_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class MailMerge | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def execute_mail_merge_template | |
file_name = "SampleMailMergeTemplateImage.doc" | |
upload_file(file_name) | |
image_name = "header-logo.png" | |
upload_file(image_name) | |
with_regions = false | |
response = @words_api.post_document_execute_mail_merge(file_name, with_regions, File.open("../../../data/SampleMailMergeTemplateImageData.txt","r") { |io| io.read }) | |
end | |
end | |
mailMerge = MailMerge.new() | |
puts mailMerge.execute_mail_merge_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class MailMerge | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def populate_document_template_with_data | |
file_name = "SampleExecuteTemplate.doc" | |
upload_file(file_name) | |
response = @words_api.post_execute_template(file_name, File.open("../../../data/SampleExecuteTemplateData.txt","r") { |io| io.read }) | |
end | |
end | |
mailMerge = MailMerge.new() | |
puts mailMerge.populate_document_template_with_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class MailMerge | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def populate_document_template_with_data_online | |
file_name = "SampleExecuteTemplate.doc" | |
data_file_name = "SampleExecuteTemplateData.txt" | |
file = File.open("../../../data/" << file_name,"r") { |io| io.read } | |
data = File.open("../../../data/" << data_file_name,"r") { |io| io.read } | |
response = @words_api.put_execute_template_online(file, data) | |
end | |
end | |
mailMerge = MailMerge.new() | |
puts mailMerge.populate_document_template_with_data_online |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithMathObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def delete_office_math_object | |
file_name = "MathsObject.docx" | |
upload_file(file_name) | |
index = 1 | |
response = @words_api.delete_office_math_object(file_name, index, opts = {}) | |
end | |
end | |
workingWithMathObjects = WorkingWithMathObjects.new() | |
puts workingWithMathObjects.delete_office_math_object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithMathObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_office_math_object | |
file_name = "MathsObject.docx" | |
upload_file(file_name) | |
index = 1 | |
response = @words_api.get_office_math_object(file_name, index) | |
end | |
end | |
workingWithMathObjects = WorkingWithMathObjects.new() | |
puts workingWithMathObjects.get_office_math_object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithMathObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_office_math_objects | |
file_name = "MathsObject.docx" | |
upload_file(file_name) | |
response = @words_api.get_office_math_objects(file_name) | |
end | |
end | |
workingWithMathObjects = WorkingWithMathObjects.new() | |
puts workingWithMathObjects.get_office_math_objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithMathObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_office_math_objects_for_a_particular_paragraph | |
file_name = "MathsObject.docx" | |
upload_file(file_name) | |
paragraph_index = 1 | |
response = @words_api.get_office_math_objects_for_a_particular_paragraph(file_name, paragraph_index) | |
end | |
end | |
workingWithMathObjects = WorkingWithMathObjects.new() | |
puts workingWithMathObjects.get_office_math_objects_for_a_particular_paragraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithMathObjects | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_office_math_objects_for_a_particular_section | |
file_name = "MathsObject.docx" | |
upload_file(file_name) | |
section_index = 0 | |
paragraph_index = 1 | |
response = @words_api.get_office_math_objects_for_a_particular_section(file_name, section_index, paragraph_index, opts = {}) | |
end | |
end | |
workingWithMathObjects = WorkingWithMathObjects.new() | |
puts workingWithMathObjects.get_office_math_objects_for_a_particular_section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithParagraphs | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# This resource represents one of the paragraphs contained in the document. | |
def get_document_paragraph | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
paragraph_index = 1 | |
response = @words_api.get_document_paragraph(file_name, paragraph_index) | |
end | |
end | |
workingWithParagraphs = WorkingWithParagraphs.new() | |
puts workingWithParagraphs.get_document_paragraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithParagraphs | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# This resource represents one of the paragraphs contained in the document. | |
def get_document_paragraph_run | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
paragraph_index = 0 | |
run_index = 0 | |
response = @words_api.get_document_paragraph_run(file_name, paragraph_index, run_index) | |
end | |
end | |
workingWithParagraphs = WorkingWithParagraphs.new() | |
puts workingWithParagraphs.get_document_paragraph_run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithParagraphs | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# This resource represents one of the paragraphs contained in the document. | |
def get_document_paragraph_run_font | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
paragraph_index = 0 | |
run_index = 0 | |
response = @words_api.get_document_paragraph_run_font(file_name, paragraph_index, run_index) | |
end | |
end | |
workingWithParagraphs = WorkingWithParagraphs.new() | |
puts workingWithParagraphs.get_document_paragraph_run_font |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithParagraphs | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Return a list of paragraphs that are contained in the document. | |
def get_document_paragraphs | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_paragraphs(file_name) | |
end | |
end | |
workingWithParagraphs = WorkingWithParagraphs.new() | |
puts workingWithParagraphs.get_document_paragraphs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithParagraphs | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# This resource represents one of the paragraphs contained in the document. | |
def post_document_paragraph_run_font | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
font = Font.new | |
font.name = "Arial" | |
font.bold = true | |
paragraph_index = 0 | |
run_index = 0 | |
response = @words_api.post_document_paragraph_run_font(file_name, paragraph_index, run_index, font) | |
end | |
end | |
workingWithParagraphs = WorkingWithParagraphs.new() | |
puts workingWithParagraphs.post_document_paragraph_run_font |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Protection | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Change document protection. | |
def change_document_protection | |
file_name = "SampleWordDocument.docx" | |
#upload_file(file_name) | |
protection_data = ProtectionRequest.new | |
protection_data.password = "newPassword" | |
response = @words_api.post_change_document_protection(file_name, protection_data) | |
end | |
end | |
protection = Protection.new() | |
puts protection.change_document_protection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Protection | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Protect document. | |
def protect_document | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
protection_data = ProtectionRequest.new | |
protection_data.password = "myPassword" | |
response = @words_api.put_protect_document(file_name, protection_data) | |
end | |
end | |
protection = Protection.new() | |
puts protection.protect_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Protection | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document protection common info. | |
def read_document_protection_common_info | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_protection(file_name) | |
end | |
end | |
protection = Protection.new() | |
puts protection.read_document_protection_common_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Protection | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Unprotect document. | |
def unprotect_document | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
protection_data = ProtectionRequest.new | |
protection_data.password = "myPassword" | |
response = @words_api.delete_unprotect_document(file_name, protection_data) | |
end | |
end | |
protection = Protection.new() | |
puts protection.unprotect_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithSections | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get document section by index. | |
def get_document_section_by_index | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
section_index = 0 | |
response = @words_api.get_section(file_name, section_index) | |
end | |
end | |
workingWithSections = WorkingWithSections.new() | |
puts workingWithSections.get_document_section_by_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithPageSetup | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get page setup of section. | |
def get_section_page_setup | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
section_index = 0 | |
response = @words_api.get_section_page_setup(file_name, section_index) | |
end | |
end | |
workingWithPageSetup = WorkingWithPageSetup.new() | |
puts workingWithPageSetup.get_section_page_setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithSections | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Return a list of sections that are contained in the document. | |
def get_sections | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_sections(file_name) | |
end | |
end | |
workingWithSections = WorkingWithSections.new() | |
puts workingWithSections.get_sections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithPageSetup | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Update page setup of section. | |
def update_section_page_setup | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
page_setup = PageSetup.new | |
page_setup.rtl_gutter = true | |
page_setup.left_margin = 10.0 | |
page_setup.orientation = "Landscape" | |
page_setup.paper_size = "A5" | |
section_index = 0 | |
response = @words_api.update_section_page_setup(file_name, section_index, page_setup) | |
end | |
end | |
workingWithPageSetup = WorkingWithPageSetup.new() | |
puts workingWithPageSetup.update_section_page_setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithSplitResource | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def split_all_pages_to_new_pdfs | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.post_split_document(file_name, {format: "pdf", zip_output: true}) | |
end | |
end | |
workingWithSplitResource = WorkingWithSplitResource.new() | |
puts workingWithSplitResource.split_all_pages_to_new_pdfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithSplitResource | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def split_specific_pages_to_any_supported_format | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.post_split_document(file_name, {format: "text", from: 1, to: 2, zip_output: false}) | |
end | |
end | |
workingWithSplitResource = WorkingWithSplitResource.new() | |
puts workingWithSplitResource.split_specific_pages_to_any_supported_format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithSplitResource | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def split_specific_pages_to_new_pdfs | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.post_split_document(file_name, {format: "pdf", from: 1, to: 2, zip_output: false}) | |
end | |
end | |
workingWithSplitResource = WorkingWithSplitResource.new() | |
puts workingWithSplitResource.split_specific_pages_to_new_pdfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithTables | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def delete_borders | |
file_name = "TableDocument.doc" | |
upload_file(file_name) | |
table_index = 1 | |
row_index = 0 | |
response = @words_api.get_borders(file_name, table_index, row_index) | |
end | |
end | |
workingWithTables = WorkingWithTables.new() | |
puts workingWithTables.delete_borders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithTables | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def delete_table | |
file_name = "TableDocument.doc" | |
upload_file(file_name) | |
index = 1 | |
response = @words_api.delete_table(file_name, index) | |
end | |
end | |
workingWithTables = WorkingWithTables.new() | |
puts workingWithTables.delete_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithTables | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_borders | |
file_name = "TableDocument.doc" | |
upload_file(file_name) | |
table_index = 1 | |
row_index = 0 | |
response = @words_api.get_borders(file_name, table_index, row_index) | |
end | |
end | |
workingWithTables = WorkingWithTables.new() | |
puts workingWithTables.get_borders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithTables | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def get_table | |
file_name = "TableDocument.doc" | |
upload_file(file_name) | |
index = 1 | |
response = @words_api.get_table(file_name, index) | |
end | |
end | |
workingWithTables = WorkingWithTables.new() | |
puts workingWithTables.get_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithText | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document text items. | |
def read_document_text_items | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
response = @words_api.get_document_text_items(file_name) | |
end | |
end | |
workingWithText = WorkingWithText.new() | |
puts workingWithText.read_document_text_items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class WorkingWithText | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Replace document text. | |
def replace_text | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
replace_text = ReplaceTextRequest.new | |
replace_text.old_value = "Times New Roman" | |
replace_text.current_value = "Arial Black" | |
response = @words_api.post_replace_text(file_name, replace_text) | |
end | |
end | |
workingWithText = WorkingWithText.new() | |
puts workingWithText.replace_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Watermark | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Delete watermark (for deleting last watermark from the document). | |
def delete_document_watermark | |
file_name = "SampleBlankWatermarkDocument.docx" | |
upload_file(file_name) | |
response = @words_api.delete_document_watermark(file_name) | |
end | |
end | |
watermark = Watermark.new() | |
puts watermark.delete_document_watermark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Watermark | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Insert document watermark image. | |
def insert_watermark_image | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
image_file_name = "aspose-cloud.png" | |
upload_file(image_file_name) | |
response = @words_api.post_insert_watermark_image(file_name, {rotation_angle: 45, image: image_file_name}) | |
end | |
end | |
watermark = Watermark.new() | |
puts watermark.insert_watermark_image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Cloud | |
require 'aspose_words_cloud' | |
class Watermark | |
include AsposeWordsCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@words_api = WordsApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Insert document watermark text. | |
def insert_watermark_text | |
file_name = "SampleWordDocument.docx" | |
upload_file(file_name) | |
watermark_text = WatermarkText.new | |
watermark_text.text = "Welcome Aspose" | |
watermark_text.rotation_angle = 45 | |
response = @words_api.post_insert_document_watermark_text(file_name, watermark_text) | |
end | |
end | |
watermark = Watermark.new() | |
puts watermark.insert_watermark_text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment