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

C# Word - Run Processing in C#.NET


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




Overview



With C#.NET Word document paragraph processing Interface control (XDoc.Word). extract text from pdf using c#, asp.net pdf editor component, convert html to pdf using itextsharp vb.net, how to add page numbers in pdf using itextsharp c#, itextsharp add image to pdf vb.net, pdf annotation in c#. Users are allowed to process run in an existing word file or a new Word document.


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 mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects




C# DLLs: Word Run 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 Run in Paragraph



The following demo code will show you how to create a run in current paragraph. There's no content in run until you create some in it. c# remove text from pdf, remove pdf metadata c#, vb.net edit pdf, split pdf using c#, how to search text in pdf using c#, vb.net pdf create thumbnail background color, vb.net pdf preview.




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();
//Create a run for paragraph
IRun run = paragraph.CreateARun();
//Save the document
doc.Save(@"");





Set Properties of Run



We provide a series of APIs to set properties of run in word document. pdf preview in asp net c# example, asp.net show image from database, asp net replace text from pdf javascript, how to view pdf file in asp.net c#, asp.net multipage tiff viewer, asp.net edit pdf, mvc view pdf. The following demo code will show you how to operate this work.




String docFilePath = @"C:\input.docx";
//Open the document 
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document 
IDocument doc = document.GetDocument();
//Create a paragraph for document. 
IParagraph paragraph = doc.CreateParagraph();
//Create a run for paragraph. 
IRun run = paragraph.CreateARun();
//Create text for run             run.CreateText("Text Created");
//Set Properties for run. 
//Set highlight color 
run.SetHighlightColor(HighLightColor.Cyan);
//Set Italic 
run.SetItalic(true);
//Set text color             run.SetTextColor(Color.Blue);
//Set strike out 
run.SetStrikeOut(true);
//Set underline Color 
run.SetUnderlineColor(Color.Black);
//Set underline Style 
run.SetUnderlineStyle(UnderlineStyle.Single);            //Set Bold 
run.SetBold(true);
//Set Shadow Color 
run.SetShadowColor(false, Color.Brown);
//Text border 
run.CreateBorder();
doc.Save(@"C:\output.docx");





Process Text Content



If you need to process text content in run, you may use following C# demo code.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a paragraph for document.
IParagraph paragraph = doc.CreateParagraph();
//Create a run for paragraph.
IRun run = paragraph.CreateARun();
//Create text for run
run.CreateText("ABCDEFGHI");
//Delete Char
run.DeleteChar("A");
//Append text
run.AppendText("Text Appended");
//Replace char
run.ReplaceChar('B', 'b');
//MORE TODO:
//
//
doc.Save(@"");