C# DOCX

Aspose.WordsCloud .NET SDK

 

Work with Word Documents in C#

Open, generate, edit, split, merge, compare and convert a Word document in C#. It's easy for C# developers to manipulate Microsoft Word documents.
Simply integrate our Cloud API into your applications to get full-featured Word API that allows you to work, manipulate and integrate documents into your C#, ASP.NET and all other .NET apps including web, mobile, desktop, gaming, IoT, cloud, and microservices.
The main usage of this library is to create, open, edit, split, convert documents in different file formats such as DOCX, HTML, PDF, DOC, JPG, etc.
Cloud API gives you a library to do tasks programmatically in C# such as:

  • Add text in a Word document.
  • Search and replace text in Word documents.
  • Insert a table of contents.
  • Generate reports and mail merge.
  • Insert images into files.
  • Add watermark.

This API is the most agile method for a .NET developer to speed up the process of working with documents while developing a .NET app. API takes care of low-level details to make requests and handle responses. And this lets you focus on writing code specific to your particular project.

Note: Install NuGet package to start working with documents.

Cloud features for C#

  • Open, create and edit paragraphs and text.
  • Open, create and edit images, text boxes and shapes.
  • Open, create and edit tables including rows and cells.
  • Open, create and edit fields, form fields, hyperlinks and bookmarks.
  • Open, create and edit document sections, headers and footers.
  • Open, create and edit footnotes, endnotes and comments.
  • Convert documents between several popular file formats.
  • Load and save HTML/XHTML.
  • Render individual shapes from a document into raster or vector images.
  • Add and update all character formatting including fonts, colors, effects, borders, shading, etc.

Edit a Word document in C#

Cloud API provides a solution to edit a Word document with C# and all other .NET apps including web, mobile, desktop, gaming, IoT, cloud, and microservices. Using C#, you can edit an existing Word document to correct spellings or add new content to a file. Also, it's used to access and to modify document’s elements as well as their formatting.
Assume that you want to update the text in first paragraph of first section in your Word document that you have created before. So, you will need to specify the index of the first section and the first paragraph.

Create a new Word document in C#

Cloud API includes all the methods and properties to create a Word document from scratch. It allows you to insert elements such as text, paragraphs, checkboxes, tables, lists, images and all other objects that a Word document can contain.

Parse a Word Document using C#

Parse a Word document by extracting a document’s content as a plain text and save it into a .txt file.

Convert a Word Document with Cloud API

Along with the features to create and manipulate Word documents, cloud API allows you to convert a Word document from DOCX to another file format including (but not limited to) HTML, PDF, XPS, EPUB and image formats such as PNG, JPEG or BMP.

Split a Word file into multiple PDF files

  • Divide multi-page Word documents into separate Word documents.
  • Split by page number, odd/even pages and by page range.
  • Keep style and layout of the root document.

Rendering documents in Cloud

Rendering is used to define the method of converting a document into a paginated file format.
Our API allows you to perform the following:

  • Render a page to a specified format.
  • Render a table to a specified format.
  • Render a paragraph to a specified format.
  • Render drawing objects (e.g. oval, rectangle, line) to a specified format.
  • Render math objects to a specified format.
  • Render pages of a Word document to image formats including PNG, EMF, JPEG and GIF.

Swagger UI

You can use Swagger UI to visualize and interact with APIs resources.

Convert PDF to Word in C#

Cloud API allows you to convert PDF to a Word document or other supported file formats with C#.

Convert PDF to DOCX

var apiKey = "####";
var appSid = "####-####-####-####-####";
var wordsApi = new WordsApi(apiKey, appSid);

var request = new ConvertDocumentRequest(File.OpenRead("Sample.pdf"), "docx");
var result = wordsApi.ConvertDocument(request);
using (var file = new FileStream("Sample.docx", FileMode.Create, FileAccess.Write))
{
    result.CopyTo(file);
}

Advanced Features

How to open and edit a DOCX document in C#

  1. Go to the Aspose Cloud Dashboard.
  2. Create a new Account to access all applications and services or Sign In to your account.
  3. Click on My Apps tab.
  4. Get App Key and App SID.
  5. Install Aspose.Words Cloud NuGet package or use the direct download.
  6. Upload a DOCX file to the Aspose Cloud Storage.
  7. Check Developer Guide to edit a DOCX file in C#.

Support and Learning Resources