Owahi Word file utawa PDF ing Ruby SDK

Gunakake REST API kanggo ngowahi file ing Ruby kanthi program

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.

Ndeleng potongan kode

Sunting dokumen ing Ruby nggunakake REST API

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.

Sunting teks ing Ruby

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.

Sunting tabel ing Ruby

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.

Tambah gambar menyang dokumen nggunakake Ruby

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.

Ngedit dokumen online

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:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
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)
Kode roto
  
Nyalin kode Ruby menyang clipboard

Carane ngowahi file ing Ruby

  1. Pasang 'Aspose.Words Cloud kanggo Ruby'
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Ruby sampeyan
  3. Muat dokumen sing arep diowahi ing Ruby
  4. Lebokake isi ing wiwitan dokumen
  5. Download dokumen asil saka panyimpenan maya

Ruby perpustakaan kanggo nggunakake panyuntingan dokumen

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.

Requirements Sistem

Ruby 2.6 utawa luwih anyar

Deleng Repository Documentation kanggo ndeleng rincian.

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.