Nalika pangembang ngowahi HTML dokumen nganggo perpustakaan C# iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo HTML dokumen sing diwakili minangka DOM. Kanthi .NET 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.
Pustaka .NET 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.
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 C# ing dokumen kasebut.
Pilihan editing HTML liyane sing populer yaiku nyunting tabel. .NET SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang C# bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.
Saliyane nyunting teks lan tabel ing HTML, ana pilihan umum liyane: nambahake gambar menyang dokumen ing C#. Pangembang .NET uga bisa nambah gambar menyang HTML file nggunakake DOM.
Coba .NET 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:
using Aspose.Words.Cloud.Sdk;
var config = new Configuration { ClientId = "####-####-####-####-####",
ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Input.html");
var requestParagraph = new ParagraphInsert()
{
Text = "Morbi enim nunc faucibus a."
};
var insertParagraphRequest = new InsertParagraphOnlineRequest(requestDocument,
requestParagraph);
var insertParagraph = await wordsApi.InsertParagraphOnline(insertParagraphRequest);
var convertRequest = new ConvertDocumentRequest(insertParagraph.Document.Values.First(),
"html");
var convert = await wordsApi.ConvertDocument(convertRequest);
using Aspose.Words.Cloud.Sdk;
var config = new Configuration { ClientId = "####-####-####-####-####",
ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Input.html");
var requestTable = new TableInsert()
{
ColumnsCount = 1,
RowsCount = 2
};
var insertTableRequest = new InsertTableOnlineRequest(requestDocument,
requestTable, nodePath: "");
var insertTable = await wordsApi.InsertTableOnline(insertTableRequest);
var convertRequest = new ConvertDocumentRequest(insertTable.Document.Values.First(),
"html");
var convert = await wordsApi.ConvertDocument(convertRequest);
using Aspose.Words.Cloud.Sdk;
var config = new Configuration { ClientId = "####-####-####-####-####",
ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Input1.html");
var requestDrawingObject = new DrawingObjectInsert()
{
Height = 0f,
Left = 0f,
Top = 0f,
Width = 0f,
RelativeHorizontalPosition = DrawingObjectInsert.RelativeHorizontalPositionEnum.Margin,
RelativeVerticalPosition = DrawingObjectInsert.RelativeVerticalPositionEnum.Margin,
WrapType = DrawingObjectInsert.WrapTypeEnum.Inline
};
using var requestImageFile = File.OpenRead("Input2.html");
var insertDrawingObjectRequest = new InsertDrawingObjectOnlineRequest(requestDocument,
requestDrawingObject, requestImageFile, nodePath: "sections/0");
var insertDrawingObject = await wordsApi.InsertDrawingObjectOnline(insertDrawingObjectRequest);
var convertRequest = new ConvertDocumentRequest(insertDrawingObject.Document.Values.First(),
"html");
var convert = await wordsApi.ConvertDocument(convertRequest);
Instal 'Aspose.Words Cloud SDK for .NET' nggunakake manajer paket NuGet. Mung mbukak nuget install Aspose.Words-Cloud otomatis nginstal lan ngrujuk perakitan sing cocog ing proyek sampeyan. Minangka alternatif, sampeyan bisa kanthi manual tiron Aspose.Words Cloud SDK for .NET kode sumber saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian liyane.
Sampeyan bisa nindakake operasi suntingan kanggo format file liyane: