Skip to content

Instantly share code, notes, and snippets.

using System.IO;
using Aspose.Words.Cloud.Sdk;
using Aspose.Words.Cloud.Sdk.Model;
using Aspose.Words.Cloud.Sdk.Model.Requests;
namespace WordsSample.Words
{
public class WordFileOperations
{
public void InsertSection()
{
var wordsApi = new WordsApi("Client ID", "Client Secret");
var request = new InsertSectionOnlineRequest();
request.Document = File.OpenRead("Sections.docx");
request.SectionIndex = 0;
var task = wordsApi.InsertSectionOnline(request);
task.Wait();
var result = task.Result;
if(result.TryGetValue("", out var stream))
{
stream.Position = 0;
using (var fileStream = File.Create("RemoveSection.docx"))
{
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment