Building a large text file editor – Part II

In the previous post I created a class that was going to be used as an interface between a large file editor and the file on the disk. Since then I’ve been implementing the user interface and, obviously, the RevisionStream also needed some readjustment. Here are some major changes that were done: – detecting encoding…


Building a large text file editor – Part I

The purpose of this series of two blog posts is to illustrate how an editor for large files can be implemented. The first part will address the model behind the editor whereas the second part will include an actual UserControl that allows users to view and edit large files. The basic idea behind a large…


Monitoring when registry keys are modified

Let’s say you want to see where a certain setting from Word Options is saved in Registry.   The easiest method is using Process Monitor. Add a filter on Process Name and Operation, start Word and that’s that:  If we uncheck “Allow background saves” from Word Options – Advanced – Save, this is what appears in Process Monitor:…


Back to school – Office art geometry

Let’s start off with the following observation- the following two shapes have the same Left and Top coordinates:   What’s different is obviously the rotation. What Office saves for a shape is the Left and Top coordinates together with a Rotation. So the Top coordinate, for instance, is not necessarily the uppermost part of a shape….


Using DDE in C# for Office automation

  Looking for some code samples how to pass DDE messages from a .NET program I found out that there‘s a great library already in place that facilitates working with DDE: the NDde project from Codeplex: However, I just needed to make one call and including a new DLL into my code would have…


Using .NET library in VBA

Three easy steps for exporting .NET functionality to VBA: 1. Write a source file:   using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; namespace InteropTest { [Guid(“BEB2C62D-5646-4B08-81DF-670314BFEE4A”)] public class InteropTestClass { public void Help() { MessageBox.Show(“Hello From .NET!”); } } } The GUID needs to be unique. 2. Generate a strong…


Recovering the pictures from a PPT file

  The PPT file format is very well documented as per Microsoft’s Open Specification Promise. However, accessing any part of a PPT file isn’t really a snap. I’ve created a small C# program which parses the \Pictures stream from a PPT file. For that, one needs to: Extract the Pictures stream from the PPT OLE…


Complex editing of XLSX files

  Editing Excel OpenXML documents using the OpenXML 2.0 SDK offers better performace and improved supportability compared to normal Office automation (e.g. VBA). There are also great examples on the Internet to get started: Office Open XML Formats: Inserting Values into Excel 2007 Cells. What I haven’t found until now is some clarifications as to…


Indenting XML files

  The operation of indenting XML files is pretty trivial when using the classes from the System.XML namespace. However, I often find myself trying to read canonical XML code from files. As such, a created a very simple tool that converts XML files to indented XML. All you need to do is to drag and…


List styles in Word document with preview

  The sample code from my previous post does a pretty good job listing the styles in a Word document. However, having a preview of these styles makes it a lot easier to spot the subtle differences than by using the Description object. For generating a preview of the styles I used some code posted…