Tag Archives: visual studio

Visual Studio Extension -Ngrok

Ngrok is now widely being used. From simple web development up to complex development. Is hard to run Ngrok everytime you are coding specially when using IIS Express that if not configured to use a specific IP it will generate random port which is a hard to map.

Thankfully there is a plug-in for our beloved Visual Studio to integrate this.

Ngrok Extensions

With Ngrok Extension we only open our Visual Studio solution and navigate to Tool>Start ngrok Tunnel and it will create a tunnel for the websites under your solution.

Try it now!

God Bless!

Thanks,
Thomie

Replace words on MS Word using C#

Hi,

Recently I was instructed to create an application that will be able to replace an array of words and replace them with an array of corresponding words on an MS Word document. With this I’ve searched the following:

Prerequisites

  1. Visual Stduio
  2. Install the nuget package DocX
  3. Administrative access on the context the application is running

Code

Dictionary<string, string> lReplacements = new Dictionary<string, string>();
string newFullPath = @”c:\sample.docx”;

using (DocX document = DocX.Load(newFullPath))
{

//for loop is better than foreach
foreach (var item in lReplacements)
{

document.ReplaceText(item.Key, item.Value);

}
document.Save();

}

Hope it helped you as it helped me with this simple snippet.

God Bless!
Thanks,
Thomie