Nalika pangembang ngowahi dokumen nganggo solusi Ruby sing diwenehake, sing bener-bener diowahi yaiku Model Obyek Dokumen (DOM). Mangkono, meh kabeh owah-owahan bisa digawe kanggo document dituduhake minangka DOM. Kanthi Ruby SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup muat Word, PDF utawa file ing format muat sing didhukung, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing didhukung.
Pustaka Ruby kita menehi pangembang kemampuan kanggo ngowahi dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.
Penting kanggo ngerti yen nggunakake solusi Ruby iki, sampeyan bisa ngowahi dokumen ing format apa wae sing didhukung. Contone, sampeyan bisa mbukak file ing PDF, DOCX, DOC, RTF, ODT, EPUB, HTML lan format liyane, banjur ngowahi file iki lan disimpen ing format sing padha utawa ing format sing didhukung liyane.
Kasus sing paling populer kanggo nyunting Word, PDF utawa dokumen liyane yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Ruby ing dokumen kasebut.
Pilihan panyuntingan dokumen populer liyane yaiku nyunting tabel. Ruby SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang Ruby bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.
Saliyane nyunting teks lan tabel, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Ruby. Pangembang Ruby uga bisa nambah gambar menyang file nggunakake DOM.
Coba Ruby SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan dokumen. Nggunakake conto ing ngisor iki, muat dokumen sampeyan lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang dokumen:
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
request_document = File.open('Input.docx')
request_paragraph = ParagraphInsert.new({:Text => 'Morbi enim nunc faucibus a.'})
insert_paragraph_request = InsertParagraphOnlineRequest.new(document: request_document,
paragraph: request_paragraph)
insert_paragraph = @words_api.insert_paragraph_online(insert_paragraph_request)
convert_request = ConvertDocumentRequest.new(
document: insert_paragraph.document.values[0], format: 'docx')
convert = @words_api.convert_document(convert_request)
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
request_document = File.open('Input.docx')
request_table = TableInsert.new({:ColumnsCount => 1, :RowsCount => 2})
insert_table_request = InsertTableOnlineRequest.new(document: request_document,
table: request_table, node_path: '')
insert_table = @words_api.insert_table_online(insert_table_request)
convert_request = ConvertDocumentRequest.new(
document: insert_table.document.values[0], format: 'docx')
convert = @words_api.convert_document(convert_request)
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
request_document = File.open('Input1.docx')
request_drawing_object = DrawingObjectInsert.new({:Height => 0, :Left => 0, :Top => 0,
:Width => 0, :RelativeHorizontalPosition => 'Margin',
:RelativeVerticalPosition => 'Margin', :WrapType => 'Inline'})
request_image_file = File.open('Input2.docx')
insert_drawing_object_request = InsertDrawingObjectOnlineRequest.new(
document: request_document, drawing_object: request_drawing_object,
image_file: request_image_file, node_path: 'sections/0')
insert_drawing_object = @words_api.insert_drawing_object_online(insert_drawing_object_request)
convert_request = ConvertDocumentRequest.new(
document: insert_drawing_object.document.values[0], format: 'docx')
convert = @words_api.convert_document(convert_request)
Instal Aspose.Words Cloud SDK for Ruby nggunakake layanan hosting RubyGems. gem install aspose_words_cloud kanggo nginstal paket kasebut. Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for Ruby saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Ruby 2.6 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian.