How to check any existing ActiveDocument?

For office developers, you might want to check is there any existing active document is opened before you open a document template. What you can do is, check is there any open by using  (Globals.ThisAddIn.Documents.Count > 0). Then close the activeDocument using ActiveDocument.Close(ref object, ref object, ref object). Here is the snippet code that for…


Missing "Office = Microsoft.Office.Core" reference?

Missing this reference “Office = Microsoft.Office.Core”?Here is how you can add the particular reference:Step 1: Right-click your projectStep 2: Select “Add reference..”Step 3: Click on the “COM” tabStep 4: Scroll down to select “Microsoft Office 12.0 Object Library”.


How to reserve the URLs to host the WCF service

Run into this error when running your WCF service? This is because you have not reserve the url to host your WCF service.Try this solution:1. Open a Command Prompt as Administrator2. Execute this command :netsh http add urlacl url=htpp://+:8080/ user=User where User is your user name


Visual Studio 2008 is RTM!!

Yesterday at TechEd Europe we announced that Visual Studio 2008 and the .NET Framework 3.5 will be released by the end of November.There are some video recordings on the Channel 9: Lap around Visual Studio 2008 & .NET Framework 3.5 What’s new in C# 3.0?  What’s new in Visual Basic 9.0? .NET Framework 3.5 Enhancements…


Tool for Mapping Word 2007 to Custom XML

Working on OpenXML? so, how easy it is to map the content controls in word document to custom XML?You can use Content Control Toolkit, to assist you to create a data-bound document, and it’s also a good developer tool for learning about the markup you need for binding controls to data. Instead of typing the…


WCF & WF Sample Application – Layered Architecture

This is a sample application that is built by one of my colleuges — Serena Yeoh, to illustrate how to develop .NET applications using the Layered Architecture design pattern. It is not a full-blown application but a simple example to demonstrate the factoring of responsibilities and separation of concerns into multiple layers in an enterprise application.You…


Read / Write XML in Memory Stream

Use the XmlWriter to write XML to Memory Stream:MemoryStream stream = new MemoryStream();XmlWriter writer = XmlWriter.Create(stream);  or you can use the XmlDocument to save xml document to specific stream:MemoryStream stream = new MemoryStream();XmlDocument xDocument = new XmlDocument();xDocument.Save(stream); Read the xml document from tream:MemoryStream stream = new MemoryStream();XmlDocument xDocument = new XmlDocument();xDocument.Load(stream); Remember to add the following…


Current .NET technology?

What is current .NET technology?If you are using .NET 1.0 or 2.0, are you considering yourself using current .NET technology?The definition for current .NET technology:Use .Net Framework 3.X or Silverllight or ASP.NETwhere .Net Framework 3.X = .NET 2.0 plus any one of the following technologies- Windows Presentation Foundation, WPF- Windows Communication Foundation, WCF- Windows Workflow Foundation, WF- Windows…


Display .tiff image??

You can display the tiff image using Through ImageDraw’s DrawImage method. Tiff image is bitonal image. All drawing in .NET requires a Graphics object, but a Graphics object cannot be created from a bitonal image. Therefore, The .NET framework does not support modifying bitonal (i.e. single bit per pixel) images.   You may…


Migrate Application from .Net 1.1 to .Net 2.0

There are numerous API changes on .net framework 2.0 compare to .net framework 1.1. Therefore, the application that target on .net framework 1.1 might not work properly on .net framework 2.0.You have fix some of the issues that occur in the application in order for the application to work on or use the new…