Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aspose.Words-Cloud-SDK-.NET
The GIST contains SDK Examples of Aspose.Words Cloud SDK for .NET.
string MyAppKey = "xxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
// create an object of WordsAPI while passing AppKey and AppSid information
WordsApi wordsApi = new WordsApi(MyAppKey, MyAppSid);
// upload sample document to cloud storage
wordsApi.UploadFile(new UploadFileRequest(new System.IO.FileStream("/Users/nayyershahbaz/Documents/BusinessLetter.docx",
FileMode.Open, FileAccess.Read), "BusinessLetter.docx"));
// Insert Header Object on first page
var putHeaderFooterRequest = new Aspose.Words.Cloud.Sdk.Model.Requests.InsertHeaderFooterRequest("BusinessLetter.docx", "HeaderFirst", null,null);
var actual = wordsApi.InsertHeaderFooter(putHeaderFooterRequest);
// Create Run object containing sample text
var run = new Run { Text = "Aspose.Words Cloud SDK for .NET " };
// add the Run text to first paragraph of first HeaderFooter object in first section of Word document
var runRequest = new Aspose.Words.Cloud.Sdk.Model.Requests.InsertRunRequest("BusinessLetter.docx", "sections/0/headersfooters/1/paragraphs/0", run);
// Insert the RunRequest to Word Document
var actual2 = wordsApi.InsertRun(runRequest);
string MyAppKey = "xxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
public class AppendaDocument
{
public static void Run()
{
WordsApi wordsApi = new WordsApi(MyAppKey,MyAppSid);
try
{
string fileName = "Working with Header_Footer Objects.docx";
string documentToAppend = "Another sample file.docx";
// string folder = ""; // File exists at the root of the storage
string destName = "Out_Merged.docx"; // // Changes will be made in the source document
var body = new Aspose.Words.Cloud.Sdk.Model.DocumentEntryList();
System.Collections.Generic.List<Aspose.Words.Cloud.Sdk.Model.DocumentEntry> docEntries = new System.Collections.Generic.List<Aspose.Words.Cloud.Sdk.Model.DocumentEntry>();
Aspose.Words.Cloud.Sdk.Model.DocumentEntry docEntry = new Aspose.Words.Cloud.Sdk.Model.DocumentEntry { Href = documentToAppend, ImportFormatMode = "KeepSourceFormatting" };
docEntries.Add(docEntry);
body.DocumentEntries = docEntries;
Aspose.Words.Cloud.Sdk.Model.Requests.AppendDocumentRequest request = new Aspose.Words.Cloud.Sdk.Model.Requests.AppendDocumentRequest(fileName, body, null, null,null,null, destName, null, null);
Aspose.Words.Cloud.Sdk.Model.DocumentResponse result = wordsApi.AppendDocument(request);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
string MyAppKey = "xxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
// create an object of WordsAPI while passing AppKey and AppSid information
WordsApi wordsApi = new WordsApi(MyAppKey, MyAppSid);
// upload sample document to cloud storage
wordsApi.UploadFile(new UploadFileRequest(new System.IO.FileStream("/Users/nayyershahbaz/Documents/BusinessLetter.docx",
FileMode.Open, FileAccess.Read), "BusinessLetter.docx"));
// The next step is to set formatting of Header Object
var runIndex = 0;
var fontDto = new Font { Bold = true, Name = "Verdana", Size = 16, Color = new XmlColor { Web = "#e0a50d" } };
// Set formatting of text as Engrave
fontDto.Engrave = true;
// Apply formatting to first paragraph of HeaderFooter object
var documentParagraphRunFontRequest = new Aspose.Words.Cloud.Sdk.Model.Requests.UpdateRunFontRequest("BusinessLetter.docx",
fontDto, "sections/0/headersfooters/1/paragraphs/0", runIndex);
var actual4 = wordsApi.UpdateRunFont(documentParagraphRunFontRequest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.