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

C# Word - Table Row Processing in C#.NET


How to Set and Modify Table Rows in Word Document with C#.NET Solutions




Overview



C#.NET Word document table row processing Interface control (XDoc.Word).//More TODO can be used to process table rows in an existing or new Word file.


Related .net document control helps:
asp.net dotnetnuke pdf editor control: ASP.NET DNN PDF Editor Control: view, edit PDF files in Dotnetnuke application
asp.net mvc pdf editor control: ASP.NET MVC PDF Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
file redact asp.net: Redact document ASP.NET: add, delete, apply redaction on PDF files in web browser using C#.net
view file asp.net: View multiple document formats in ASP.NET, MVC, Ajax, Azure using C# control
asp.net sharepoint pdf editor control: ASP.NET SharePoint PDF Editor Control: view, edit, annotate, redact PDF document in SharePoint sites
asp.net sharepoint file viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net office file viewer: ASP.NET Office Word Document Viewer: view MS Office Word files online using C# in ASP.NET web applications




C# DLLs: Word Table Row 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 and Add Rows in Table



The following C# demo code will show how to create a new row in current table.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a table in body
ITable table = doc.CreateTable(3, 3);
//Create a table row for table
ITable row = table.CreateRow(3);
//Save the document
doc.Save(@"");





Set Properties of Table Row



In C# class programming, you can use specific APIs to process table row in Word document. You can set properties of all row in table, and modify them. Please refer to following C# sample code.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a Table for document
ITable table = doc.CreateTable(3, 3);
//Get all rows in table
List<ITableRow> rows = table.GetRows();
//Get first row
ITableRow row = rows[0];
//Set properties for table row
//CantSplit
row.SetCanSplit(true);
//Row height
row.SetRowHeight(1000);
//Table row repeat on every new page
row.SetTblHeader(true);
//MORE TODO:
//
//
doc.Save(@"");





Create, Add and Delete Cells in Table



If you want to create or add new cells and delete existing cells in table row, you can use our APIs in class ITableRow. The following demo code describe how to create new cells in table row.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a Table for document
ITable table = doc.CreateTable(3, 3);
//Get all rows in table
List<ITableRow> rows = table.GetRows();
//Get first row
ITableRow row = rows[0];
//Create a new cell for row
ITableCell cell = row.CreateCell();
//MORE TODO:
//
//
doc.Save(@"");