Align Attributes when Formatting XML using LINQ to XML

Sometimes an XML element contains a large number of attributes, and the values of the attributes may be long.  When written to the console, such lines wrap, making it hard to read the XML.  In particular, the XML responses from SharePoint web services often contain many attributes for each element.  However, you can use appropriate…


Convert XElement to XmlNode (and Convert XmlNode to XElement)

Sometimes you want to convert an XmlNode to an XElement and back again.  Some programming libraries define methods that take XmlNode objects as parameters.  These libraries also may contain properties and methods that return XmlNode objects.  However, it is more convenient to work with LINQ to XML instead of the classes in System.Xml (XmlDocument, XmlNode,…


Ecma General Assembly Ratifies IS29500 as Ecma 376 v.2 Standard

On Thursday, December 4, 2008 the Ecma General Assembly voted to approve Ecma 376 Edition 2 which is aligned on IS29500. This is good news for the Open XML standard and is the last step in the standardization effort for Open XML in Ecma  – started 3 nearly years ago at the December 15, 2005…


Microsoft Releases ODF Implementation Notes for Office 2007 SP2

Today, Microsoft published our first set of document-format implementation notes for the ODF implementation in Office 2007 SP2.  These notes, which are available on the DII web site, provide detailed information about the design decisions that went into our implementation of ODF 1.1. This blog is inactive.New blog: EricWhite.com/blog Blog TOCSee the press release for…


A More Robust Approach for Handling XName Objects in LINQ to XML

One of the advantages of V2 of the Open XML SDK is that it provides us with a strongly typed XML document object model (DOM).  Because elements are represented by classes, and attributes are represented by properties in the classes, developers are not at risk of misspelling element and attribute names.  I was chatting about…


Modifying Open XML Documents using the SharePoint Object Model

When working with Open XML documents from within SharePoint, you may want to open a specific document, modify it in some way, and then save it, either replacing the original document, or saving to a new location.  This isn’t very hard, but there are a few issues.  This post describes the issues and presents a…


Working with In-Memory Open XML Documents

Sometimes you want to work with Open XML documents in memory.  There are two scenarios that I know of: This blog is inactive.New blog: EricWhite.com/blog Blog TOCWhen working with document libraries in SharePoint, you retrieve a document from the document library as a byte array.  You can then modify it as necessary, and then put…


Architecture and Design of Windows Forms Custom Controls

Shortly after .NET was released, I wrote a book for Wrox Press on using GDI+ to develop Windows Forms custom controls.  Wrox subsequently declared bankruptcy, and the rights to my book were purchased by APress, where the book was republished.  You can read a review of the book here.  One of the main chapters of…


Joining LINQ to SQL and LINQ to Excel

A couple of weeks ago, I posted some code to use LINQ to query tables in an Excel spreadsheet.  Because you can query databases using LINQ to SQL, you can write code to query a database and do a join with data in an Excel spreadsheet.  This can enable some interesting scenarios – let’s say…