C# Word Library
C# Word - Document Processing in C#.NET
Provide a Series of Methods to Setup Document Properties and Modify Document Content for Users
C#.NET Word document processing Interface control (XDoc.Word).//More TODO allow users to create and process a new document by using our API.
Get All Images from Word Document
Sometimes we want to extract all images from Word document or Specific page, .XDoc.Word provides a method for users to achieve this requirement. If you happen to have this request, you may use this demo code to get all images from document as follow.
String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main ducument
IDocument doc = document.GetDocument();
//Document clone
IDocument doc0 = doc.Clone();
//Get all picture in document
List<Bitmap> bitmaps = doc0.GetAllPicture();
Create, Add, Delete or Modify Section in Word Document
We know that there're more than or equals to one section in document, if you want to get some of them or create a new section in Word document, you can use specific APIs to achieve it. The following demo code just shows you how to create a section in document. If you need more operation, you can try it yourself by using our SDK.
String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main ducument
IDocument doc = document.GetDocument();
//Document clone
IDocument doc0 = doc.Clone();
//Create a section for document
ISection section = doc0.CreateSection(0);
//Save the document
doc0.Save(@"");
Create, Add, Delete or Modify Paragraph and Table in Word Document
If you want to create, add, delete or modify some paragraphs or tables in Word document, you can use specific APIs to achieve it. The following demo code just show you how to create an empty paragraph and a table with 3 columns and 3 rows in Word document. If you need to do more operations, you can try it yourself by using our SDK.
String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main ducument
IDocument doc = document.GetDocument();
//Document clone
IDocument doc0 = doc.Clone();
//Create a table and a paragraph for document
ITable table = doc0.CreateTable(3, 3);
IParagraph paragraph = doc0.CreateParagraph();
//Save the document
doc0.Save(@"");