Created
June 2, 2024 15:07
Add Section Break in Word with NET REST API. https://kb.aspose.cloud/words/net/add-section-break-in-word-with-net-rest-api/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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