Nalika pangembang ngowahi Word dokumen nganggo perpustakaan C# iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo Word 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 Word, 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 Word dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.
Kasus sing paling populer kanggo nyunting Word file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake C# ing dokumen kasebut.
Pilihan editing Word 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 Word, ana pilihan umum liyane: nambahake gambar menyang dokumen ing C#. Pangembang .NET uga bisa nambah gambar menyang Word file nggunakake DOM.
Coba .NET SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan Word dokumen. Nggunakake conto ing ngisor iki, muat Word dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang Word dokumen:
using Aspose.Words.Cloud.Sdk;
var config = new Configuration { ClientId = "####-####-####-####-####",
ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Input.docx");
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(),
"docx");
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.docx");
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(),
"docx");
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.docx");
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.docx");
var insertDrawingObjectRequest = new InsertDrawingObjectOnlineRequest(requestDocument,
requestDrawingObject, requestImageFile, nodePath: "sections/0");
var insertDrawingObject = await wordsApi.InsertDrawingObjectOnline(insertDrawingObjectRequest);
var convertRequest = new ConvertDocumentRequest(insertDrawingObject.Document.Values.First(),
"docx");
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: