public static void CreateDocument() { try { //Create an instance for word app Word.Application winword = new Word.Application(); //Set animation status for word application winword.ShowAnimation = false; //Set status for word application is to be visible or not. winword.Visible = false; //Create a missing variable for missing value object missing = System.Reflection.Missing.Value; //Create a new document Microsoft.Office.Interop.Word.Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing); //adding text to document document.Content.SetRange(0, 0); document.Content.Text = "In this text I should add track changes " + Environment.NewLine; //Allow track changes, but I don't know how to use now document.TrackRevisions = true; //Save the document object filename = @"c:\temp1.docx"; document.SaveAs2(ref filename); document.Close(ref missing, ref missing, ref missing); document = null; winword.Quit(ref missing, ref missing, ref missing); winword = null; } catch (Exception ex) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)