Sunting HTML ing Swift SDK

Gunakake REST API kanggo nyunting HTML ing Swift kanthi terprogram

Nalika pangembang ngowahi HTML dokumen nganggo perpustakaan Swift iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo HTML dokumen sing diwakili minangka DOM. Kanthi Swift SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak HTML, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.

Ndeleng potongan kode

Sunting HTML ing Swift nggunakake REST API

Pustaka Swift kita menehi pangembang kemampuan kanggo ngowahi HTML dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.

Sunting teks ing HTML file nggunakake Swift

Kasus sing paling populer kanggo nyunting HTML file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Swift ing dokumen kasebut.

Sunting tabel ing HTML file nggunakake Swift

Pilihan editing HTML liyane sing populer yaiku nyunting tabel. Swift SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.

Pangembang Swift bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.

Tambah gambar menyang HTML file nggunakake Swift

Saliyane nyunting teks lan tabel ing HTML, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Swift. Pangembang Swift uga bisa nambah gambar menyang HTML file nggunakake DOM.

Sunting HTML kanthi terprogram

Coba Swift SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan HTML dokumen. Nggunakake conto ing ngisor iki, muat HTML dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang HTML dokumen:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input.html"))!;
let requestParagraph = ParagraphInsert()
  .setText(text: "Morbi enim nunc faucibus a.");
let insertParagraphRequest = InsertParagraphOnlineRequest(document: requestDocument, 
   paragraph: requestParagraph);
let insertParagraph = try api.insertParagraphOnline(request: insertParagraphRequest);

let convertRequest = ConvertDocumentRequest(document: insertParagraph.document.values.first,
  format: "html");
let convert = try api.convertDocument(request: convertRequest);
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input.html"))!;
let requestTable = TableInsert()
  .setColumnsCount(columnsCount: 1)
  .setRowsCount(rowsCount: 2);
let insertTableRequest = InsertTableOnlineRequest(document: requestDocument, 
   table: requestTable, nodePath: "");
let insertTable = try api.insertTableOnline(request: insertTableRequest);

let convertRequest = ConvertDocumentRequest(document: insertTable.document.values.first,
  format: "html");
let convert = try api.convertDocument(request: convertRequest);
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input1.html"))!;
let requestDrawingObject = DrawingObjectInsert()
  .setHeight(height: 0)
  .setLeft(_left: 0)
  .setRelativeHorizontalPosition(
     relativeHorizontalPosition: DrawingObjectInsert.RelativeHorizontalPosition.margin)
  .setRelativeVerticalPosition(
     relativeVerticalPosition: DrawingObjectInsert.RelativeVerticalPosition.margin)
  .setTop(top: 0)
  .setWidth(width: 0)
  .setWrapType(wrapType: DrawingObjectInsert.WrapType.inline);

let requestImageFile = InputStream(url: URL(string: "Input2.html"))!;
let insertDrawingObjectRequest = InsertDrawingObjectOnlineRequest(document: requestDocument, 
   drawingObject: requestDrawingObject, imageFile: requestImageFile, nodePath: "sections/0");
let insertDrawingObject = 
   try api.insertDrawingObjectOnline(request: insertDrawingObjectRequest);

let convertRequest = ConvertDocumentRequest(
   document: insertDrawingObject.document.values.first, format: "html");
let convert = try api.convertDocument(request: convertRequest);
Kode roto
  
Nyalin kode Swift menyang clipboard

Cara Ngowahi HTML ing Swift

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

Pustaka Swift kanggo nggunakake panyuntingan HTML.

Sampeyan bisa nggunakake manajer paket Swift lan manajer dependensi Cocoapods kanggo nginstal Aspose.Words Cloud SDK for Swift. Informasi rinci babagan nginstal paket diwenehi ing bagean "Installation and Usage".

Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Swift saka GitHub lan nggunakake ing project.

Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.

Requirements Sistem

Swift 4.2 utawa luwih anyar

Deleng Repository Documentation kanggo ndeleng rincian liyane.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi suntingan kanggo format file liyane:

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.