diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Bookmark/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Bookmark/VSTO Words/ThisAddIn.cs index 7413b5505..4a89b2a4c 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Bookmark/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Bookmark/VSTO Words/ThisAddIn.cs @@ -9,7 +9,9 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) { Word.Application wordApp = Application; - wordApp.Documents.Open("Add Bookmark.doc"); + string filePath = @"..\..\..\..\..\Sample Files\"; + + wordApp.Documents.Open(filePath + "MyDocument.docx"); Document extendedDocument = Globals.Factory.GetVstoObject(this.Application.ActiveDocument); Bookmark firstParagraph = extendedDocument.Controls.AddBookmark( diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Headers and Footers to Doc/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Headers and Footers to Doc/VSTO Words/ThisAddIn.cs index b6b7a2fdf..8861db36f 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Headers and Footers to Doc/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Headers and Footers to Doc/VSTO Words/ThisAddIn.cs @@ -6,11 +6,13 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = ""; Word.Application wordApp = Application; - wordApp.Documents.Open(mypath + "Add Headers and Footers.doc"); - //Add Header + string filePath = @"..\..\..\..\..\Sample Files\"; + + wordApp.Documents.Open(filePath + "MyDocument.docx"); + + // Add a header. foreach (Word.Section section in this.Application.ActiveDocument.Sections) { Word.Range headerRange = section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range; @@ -18,7 +20,7 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) headerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight; } - //Add Footer + // Add a footer. foreach (Word.Section wordSection in this.Application.ActiveDocument.Sections) { Word.Range footerRange = wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range; diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/Aspose Words/Program.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/Aspose Words/Program.cs index cd380e968..1ad9e3b03 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/Aspose Words/Program.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/Aspose Words/Program.cs @@ -12,23 +12,25 @@ static void Main(string[] args) Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); - // Insert a shape which contains and displays an image taken from a file in the local file system. - builder.InsertImage("download.jpg"); + string filePath = @"..\..\..\..\..\Sample Files\"; + + // Insert a shape into the document with an image taken from a file in the local file system. + builder.InsertImage(filePath + "Logo.jpg"); // Insert a shape which contains WordArt with customized text. - Shape shape = new Shape(doc, ShapeType.TextPlainText) - { - WrapType = WrapType.Inline, - Width = 480, - Height = 24, - FillColor = Color.Orange, - StrokeColor = Color.Red - }; + Shape wordArtShape = new Shape(doc, ShapeType.TextCurve); + wordArtShape.Width = 480; + wordArtShape.Height = 24; + wordArtShape.FillColor = Color.Orange; + wordArtShape.StrokeColor = Color.Red; + wordArtShape.WrapType = WrapType.Inline; + + wordArtShape.TextPath.FontFamily = "Arial"; + wordArtShape.TextPath.Bold = true; + wordArtShape.TextPath.Italic = true; + wordArtShape.TextPath.Text = "Hello World! This text is bold, and italic."; - shape.TextPath.FontFamily = "Arial"; - shape.TextPath.Bold = true; - shape.TextPath.Italic = true; - shape.TextPath.Text = "Hello World! This text is bold, and italic."; + doc.FirstSection.Body.LastParagraph.AppendChild(wordArtShape); doc.Save("Add Picture and WordArt.docx"); } diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/VSTO Words/ThisAddIn.cs index 4b9049d85..2b03777f1 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture and WordArt/VSTO Words/ThisAddIn.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; +using Word = Microsoft.Office.Interop.Word; using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; namespace VSTO_Words { @@ -13,25 +7,24 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = ""; + string filePath = @"..\..\..\..\..\Sample Files\"; + Word.Application wordApp = Application; - wordApp.Documents.Open(mypath+"Add Picture and WordArt.doc"); + wordApp.Documents.Open(filePath + "MyDocument.docx"); //Add picture to Doc - this.Application.Selection.InlineShapes.AddPicture(mypath+"download.jpg"); + this.Application.Selection.InlineShapes.AddPicture(filePath + "Logo.jpg"); - //Add WordArt - //Get the left and top position of the current cursor location. + // Add WordArt. + // Get the left and top position of the current cursor location. float leftPosition = (float)this.Application.Selection.Information[ Word.WdInformation.wdHorizontalPositionRelativeToPage]; float topPosition = (float)this.Application.Selection.Information[ Word.WdInformation.wdVerticalPositionRelativeToPage]; - //Call the AddTextEffect method of the Shapes object of the active document (or a different document that you specify). - + // Call the AddTextEffect method of the Shapes object of the active document (or a different document that you specify). this.Application.ActiveDocument.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect29, "test","Arial Black", 24, Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse, leftPosition, topPosition); - } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/Aspose Words/Program.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/Aspose Words/Program.cs index 17026d856..ce10f1b26 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/Aspose Words/Program.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/Aspose Words/Program.cs @@ -10,8 +10,10 @@ static void Main(string[] args) Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); + string filePath = @"..\..\..\..\..\Sample Files\"; + // Insert a shape into the document with an image taken from a file in the local file system. - builder.InsertImage("download.jpg"); + builder.InsertImage(filePath + "Logo.jpg"); doc.Save("Add Picture.docx"); } diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/VSTO Words/ThisAddIn.cs index 360e10cf9..562c15228 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Add Picture/VSTO Words/ThisAddIn.cs @@ -6,13 +6,13 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = ""; + string filePath = @"..\..\..\..\..\Sample Files\"; Word.Application wordApp = Application; - wordApp.Documents.Open(mypath+"Add Picture.doc"); - //Add picture to Doc - this.Application.Selection.InlineShapes.AddPicture(mypath+"download.jpg"); - + wordApp.Documents.Open(filePath + "MyDocument.docx"); + + // Insert an image into the document. + this.Application.Selection.InlineShapes.AddPicture(filePath + "Logo.jpg"); } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/Aspose Words/Program.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/Aspose Words/Program.cs index 05448e280..8af6ab6c1 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/Aspose Words/Program.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/Aspose Words/Program.cs @@ -19,9 +19,9 @@ static void Main(string[] args) // If we wish to apply page setup changes to an entire document, we will need to iterate over every section. foreach (Section section in doc) - section.PageSetup.PaperSize = PaperSize.Letter; + section.PageSetup.PaperSize = PaperSize.EnvelopeDL; - doc.Save("Section.ModifyPageSetupInAllSections.docx"); + doc.Save("Changing Page Setup for Whole Document.docx"); } } } diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/VSTO Words/ThisAddIn.cs index a050e7942..1484eafdc 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Changing Page Setup for Whole Document/VSTO Words/ThisAddIn.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; +using Word = Microsoft.Office.Interop.Word; namespace VSTO_Words { diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Display Documents in Print Preview/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Display Documents in Print Preview/VSTO Words/ThisAddIn.cs index 55b29c9ca..1cd3a8d9c 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Display Documents in Print Preview/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Display Documents in Print Preview/VSTO Words/ThisAddIn.cs @@ -1,13 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; - -namespace VSTO_Words +namespace VSTO_Words { public partial class ThisAddIn { diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/Aspose Words/Program.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/Aspose Words/Program.cs index 3b08e8730..4b4e39e45 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/Aspose Words/Program.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/Aspose Words/Program.cs @@ -30,6 +30,8 @@ static void Main(string[] args) { table.PreferredWidth = PreferredWidth.FromPercent(100); } + + doc.Save("Fitting all Tables to the Page Width.docx"); } } } diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/VSTO Words/ThisAddIn.cs index b7b4f4b49..e134c10ab 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Fitting all Tables to the Page Width/VSTO Words/ThisAddIn.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; +using Word = Microsoft.Office.Interop.Word; using Microsoft.Office.Interop.Word; namespace VSTO_Words @@ -14,9 +7,10 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = "Document.docx"; + string filePath = @"..\..\..\..\..\Sample Files\"; Word.Application wordApp = Application; - wordApp.Documents.Open(mypath); + + wordApp.Documents.Open(filePath + "MyDocument.docx"); foreach (Table table in this.Application.ActiveDocument.Tables) { diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Joining Documents Together/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Joining Documents Together/VSTO Words/ThisAddIn.cs index 8fcc1b6c1..78d30e6dd 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Joining Documents Together/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Joining Documents Together/VSTO Words/ThisAddIn.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; +using Word = Microsoft.Office.Interop.Word; namespace VSTO_Words { @@ -13,15 +6,17 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = "Document.docx"; + string filePath = @"..\..\..\..\..\Sample Files\"; Word.Application wordApp = Application; - wordApp.Documents.Open(mypath); + + wordApp.Documents.Open(filePath + "MyDocument.docx"); + int recordCount = 2; int i = 0; for (i = 0; i <= recordCount; i++) wordApp.Selection.WholeStory(); wordApp.Selection.EndOf(); - wordApp.Selection.InsertFile("DetailsList.docx"); + wordApp.Selection.InsertFile(filePath + "MyDocument.docx"); if (i < recordCount) { @@ -29,10 +24,8 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) } if (i > 1) { - //wordApp.ActiveDocument.Sections(i).Headers(1).LinkToPrevious = false; } - } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Print Documents/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Print Documents/VSTO Words/ThisAddIn.cs index 123573bfe..0c7f8e4f4 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Print Documents/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Print Documents/VSTO Words/ThisAddIn.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; +using Word = Microsoft.Office.Interop.Word; namespace VSTO_Words { diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Protect Documents/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Protect Documents/VSTO Words/ThisAddIn.cs index 4d3eff05e..2db67f9ba 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Protect Documents/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Protect Documents/VSTO Words/ThisAddIn.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; +using Word = Microsoft.Office.Interop.Word; namespace VSTO_Words { @@ -14,7 +7,7 @@ public partial class ThisAddIn private void ThisAddIn_Startup(object sender, System.EventArgs e) { object noReset = false; - object password = System.String.Empty; + object password = "MyPassword"; object useIRM = false; object enforceStyleLock = false; diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Remove All Comments from Documents/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Remove All Comments from Documents/VSTO Words/ThisAddIn.cs index 071b5421d..2962a018a 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Remove All Comments from Documents/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Remove All Comments from Documents/VSTO Words/ThisAddIn.cs @@ -1,13 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using Word = Microsoft.Office.Interop.Word; -using Office = Microsoft.Office.Core; -using Microsoft.Office.Tools.Word; - -namespace VSTO_Words +namespace VSTO_Words { public partial class ThisAddIn { diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Removing Header and Footer/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Removing Header and Footer/VSTO Words/ThisAddIn.cs index e834399ae..45894783f 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Removing Header and Footer/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Removing Header and Footer/VSTO Words/ThisAddIn.cs @@ -6,12 +6,13 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = ""; - - Word.Document doc = Application.Documents.Open(mypath+"Add Headers and Footers.doc"); - Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete(); - Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete(); - + string filePath = @"..\..\..\..\..\Sample Files\"; + Word.Application wordApp = Application; + + Word.Document doc = wordApp.Documents.Open(filePath + "MyDocument.docx"); + + Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete(); + Globals.ThisAddIn.Application.ActiveDocument.Sections[1].Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Paragraphs.Last.Range.Delete(); } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/Aspose Words/Program.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/Aspose Words/Program.cs index d1f41d7be..0cad678e8 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/Aspose Words/Program.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/Aspose Words/Program.cs @@ -10,7 +10,7 @@ static void Main(string[] args) Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); - builder.Writeln("find me"); + builder.Writeln("Hello world!"); FindReplaceOptions options = new FindReplaceOptions { @@ -18,7 +18,7 @@ static void Main(string[] args) FindWholeWordsOnly = true }; - doc.Range.Replace("find me", "found", options); + doc.Range.Replace("Hello world!", "Greetings planet!", options); doc.Save("Search for and Replace text.docx"); } diff --git a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/VSTO Words/ThisAddIn.cs b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/VSTO Words/ThisAddIn.cs index f8479cc56..008e33d95 100644 --- a/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/VSTO Words/ThisAddIn.cs +++ b/Plugins/Aspose.Words Vs VSTO Word/Code Comparison of Common Features/Search for and Replace text/VSTO Words/ThisAddIn.cs @@ -6,16 +6,18 @@ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { - string mypath = ""; + string filePath = @"..\..\..\..\..\Sample Files\"; Word.Application wordApp = Application; - wordApp.Documents.Open(mypath + "Search and Replace.doc"); + + wordApp.Documents.Open(filePath + "MyDocument.docx"); + object replaceAll = Word.WdReplace.wdReplaceAll; this.Application.Selection.Find.ClearFormatting(); - this.Application.Selection.Find.Text = "find me"; + this.Application.Selection.Find.Text = "Hello world!"; this.Application.Selection.Find.Replacement.ClearFormatting(); - this.Application.Selection.Find.Replacement.Text = "Found"; + this.Application.Selection.Find.Replacement.Text = "Greetings planet!"; this.Application.Selection.Find.Execute( ref missing, ref missing, ref missing, ref missing, ref missing, diff --git a/Plugins/Aspose.Words Vs VSTO Word/Sample Files/Logo.jpg b/Plugins/Aspose.Words Vs VSTO Word/Sample Files/Logo.jpg new file mode 100644 index 000000000..5a6c2894d Binary files /dev/null and b/Plugins/Aspose.Words Vs VSTO Word/Sample Files/Logo.jpg differ