Leaving Microsoft, Blog Moving to EricWhite.com

Due to personal obligations (moving away from Seattle) it is with sadness that I’m announcing that I’m leaving Microsoft.  My last day at Microsoft will be January 21.  This will be the last post on this blog.  I will be commencing to blog at EricWhite.com/blog.  Here is what I’m planning for the near future on…

8

Table Markup in Open XML SpreadsheetML

Tables are a feature in Open XML spreadsheets that allow you to interact with data more like a database.  You can select a region and convert it to a table.  Most Excel aficionados are familiar with this feature.  It is very useful. This blog is inactive.New blog: EricWhite.com/blog Blog TOC  In a previous post, Using…

2

Recursive Descent Parser using LINQ: The Augmented Backus-Naur Form Grammar

[Blog Map]  This blog is inactive.  New blog: EricWhite.com/blog A grammar is a device to define syntax for a language.  A grammar is made up of rules, sometimes called productions.  Each rule defines a symbol, when can then be further used in other rules.  Grammars are not hard to understand; most developers instinctively understand grammars when they…

0

Hex Dump using LINQ (in 7 Lines of Code)

At one point while debugging the HtmlConverter class, when I found certain situations in the XML, I wanted to dump the XML in binary to see the actual hex values of characters being used.  I got tired of stopping and examining the values in the debugger.  I did a couple of searches, and found some…

10

Ad-Hoc String Concatenation using LINQ

I regularly use functional programming and LINQ in two contexts – when writing code that is part of an example or tool that will potentially execute millions of times, and when writing ad-hoc queries.  These days, I use C# and LINQ as my ‘scripting language’, to iterate through directory structures, open and process Open XML…

6

Convert XDocument to XmlDocument (and Convert XmlDocument to XDocument)

Some time ago, I blogged about an approach for converting an XElement object to an XmlNode object, and vice versa.  This is useful when you want to use a programming interface that takes and returns objects of type XmlNode, but you want to use the expressiveness and power of LINQ to XML for your code…

1

Rollup Extension Method: Create Running Totals using LINQ to Objects

Recently, I had need for a new extension method for IEnumerable<T>, which I call “Rollup”.  This extension method is sort of a cross between the Select and Aggregate extension methods.  Like Select, when using this extension method you write a lambda expression to project the new value in a new collection.  Unlike Select, in the…

2

Writing Entity References using LINQ to XML

I need to write out some XHtml, and in several places, I want that XHtml to contain entities references.  However, you can’t simply write the entity reference like this: This is one in a series of posts on transforming Open XML WordprocessingML to XHtml.  You can find the complete list of posts here. This blog is inactive.New…

2

DescendantsAndSelfTrimmed LINQ to XML Axis Method

There are some circumstances where I need a variation on the DescendantsAndSelf axis method that allows me to specify that specific elements (and the descendants of those elements) are ‘trimmed’ from the returned collection.  One of the things that’s great about LINQ to XML is the ease with which we can create specialized axis methods…

0

Merging Comments from Multiple Open XML Documents into a Single Document

Microsoft Word 2007 allows you to lock a document, prohibiting users from making changes to content, while allowing them to add comments.  If we have multiple documents that have the same content yet different comments, we can merge those comments into a single document.  One possible use would be a specification review system.  After the specification writer…

4