C#: Online Guide
How To: Word SDK
Paragraph Processing
Paragraph Processing
  |  
Home ›› XDoc.Word ›› C# Word: Process Paragraph

C# Word - Paragraph Processing in C#.NET


Provide Various Methods to Setup and Modify Paragraphs in Word Document for C# Users




Overview



C#.NET Word document paragraph processing Interface control (XDoc.Word). c# read pdf to text, read pdf in asp.net c#, vb.net pdf reader control, vb.net pdf generation, itext add image to existing pdf c#, c# populate pdf form fields. It is a tool which enable users to process paragraph on a new document by using our API.


Related .net document control helps:
asp.net word viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net edit pdf text: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net pdf viewer: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net powerpoint viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.




C# DLLs: Word Paragraph Processing



Add references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Word;




Create Paragraph in Word



The following demo code will show you how to create an empty paragraph in body only. You can create paragraphs in other story in the same way. vb.net save form as pdf, how to generate pdf in c# web application, vb.net excel to pdf converter, c# pdf page add, pdf compression library c#, how to redact a pdf in c#, c# draw pdf.




String docFilePath = @"";
//Open the document
DOCXDocument document =DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a empty paragraph for document
IParagraph paragraph = doc.CreateParagraph();
//Save the document
doc.Save(@"");





Set Paragraph Properties in Word



In C# class programming, you can use specific APIs to process paragraph in Word document. C# users can set paragraph properties and create content such as run, footnote, endnote and picture in a paragraph. show image in datalist asp.net c#, asp.net mvc create pdf from view, asp.net pdf preview, asp net remove image from pdf, asp.net c# view pdf, asp.net pdf editor component, asp.net add text to pdf file. The following demo code shows you how to set paragraph properties.




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 paragraph for document
IParagraph para = doc0.CreateParagraph();
//Create a run for para
IRun run = paragraph.CreateARun();
//Create text for run
run.CreateText("ABCDEFG");
//Paragraph properties.
//Create borders for para
para.CreateBorders();
//Indent setup
para.SetLeftIndent(500);
//Spacing setup
para.SetBoforeSpacing(300);
para.SetLineSpacing(200);
//Shadow
para.SetShadowFillColor(false, Color.Blue);
//Alignment
para.SetParagraphAlignment(ParagraphAlign.Center);
//MORE TODO:
//
//
//Save the document
doc0.Save(@"");





Create Footnote & Endnote  in Paragraph



If you need to create a footnote or endnote in a paragraph, you may use this sample code.




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 paragraph for document
IParagraph para = doc0.CreateParagraph();
//Create a run for para
IRun run = paragraph.CreateARun();
//Create text in run
run.CreateText("Run for footnote and endnote!");
//Create a footnote for paragraph
IFootNote footnote = para.CreateFootNote();
//Create a paragraph for footnote
IParagraph ftnPara = footnote.CreateParagraph(0);
//Create a Run and text for footnote content
IRun ftnRun = ftnPara.CreateARun();
ftnRun.CreateText("Footnote created!");

//Create a endnote for paragraph
IEndtNote endnote = para.CreateEndNote();
//Create a paragraph for endnote
IParagraph endnPara = endnote.CreateParagraph(0);
//Create a Run and text for endnote content
IRun endnRun = endnPara.CreateARun();
endnRun.CreateText("Endnote created!");

//Save the document
doc0.Save(@"");





Create Picture in Paragraph



If you want to insert picture in a paragraph, you can use demo code below.




String docFilePath = @"";
String imageSrcPath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main ducument
IDocument doc = document.GetDocument();
//Document clone
IDocument doc0 = doc.Clone();
//Create a paragraph for document
IParagraph para = doc0.CreateParagraph();
//Create a picture for para
IPicture picture = para.CreatePicture(imageSrcPath);
//Save the document
doc0.Save(@"");





Run Processing in Paragraph



We know a paragraph is made up of runs, if you want to modify paragraph content, you can modify run firstly. The following demo code provide a method to create run in paragraph.




String docFilePath = @"";
String imageSourcePath = @"";

//Open the document on local disk by given path.
DOCXDocument document = DOCXDocument.Open(docFilePath);

//Get the main document for edit
IDocument doc = document.GetDocument();

//Create a paragraph for document.
IParagraph paragraph = doc.CreateParagraph();

//Create a run for paragraph, now no content in run before edit.
IRun run = paragraph.CreateARun();
//Edit run
run.CreateText("Text created in run");

//Save the document after edit
doc.Save(@"");