Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active March 7, 2025 10:24
Track Changes in Word using C#. For details: https://kb.aspose.com/words/net/track-changes-in-word-using-csharp/
using System;
using Aspose.Words;
using Aspose.Words.Tables;
namespace SimpleTableDocument
{
class Program
{
static void Main(string[] args)
{
License lic = new License();
lic.SetLicense("License.lic");
Document wordDoc = new Document();
Table table = new Table(wordDoc);
table.EnsureMinimum();
Row row = new Row(wordDoc);
table.AppendChild(row);
Cell cell = new Cell(wordDoc);
row.AppendChild(cell);
wordDoc.StartTrackRevisions("The developer", DateTime.Now);
Paragraph paragraph = new Paragraph(wordDoc);
paragraph.AppendChild(new Run(wordDoc, "Sample text in the table cell."));
cell.AppendChild(paragraph);
wordDoc.FirstSection.Body.AppendChild(table);
string outputFilePath = "SimpleTableDocument.docx";
wordDoc.Save(outputFilePath);
Console.WriteLine("Document with a simple table created successfully: " + outputFilePath);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment