Office Open XML Powerpoint Table Row Woes

Experienced an interesting “feature” in Powerpoint XML development/integration recently. Basically, it appears there is no way to define a default font size/style on a table row. It’s possible to specify the default font size via the slide master but if a user forgets to set it then some interesting side effects can occur when programmatically populating a slide/presentation. In fact it looks pretty shoddy as you’ll see an empty table rows being set as some arbitrary default font size (usually Calibri 18). It’s pretty likely you’ll see any table rows without text being set to this default size which introduces creep/shift in the table. read more

XML Refresher

Haven’t really touched XML for a fair few months now so by way of a refresher I worked through the excellent Pluralsight “Many Approaches To XML Processing” course. Notes below:-

Use XmlReader when reading LARGE documents from disk – does not read complete document. very fast – use when performance is an issue. You’d typically loop through each element reading (“ReadElementString”) into a stringbuilder.

XPath is more flexible – able to navigate and select nodes (“Similar to finding folders on a hard drive”) through XML.
Use XDocument (.Load) to read into memory complete XML document. You can use

XPath (XPathSelectElement(“/Employes/Employee”)

XPath (XPathSelectElements(“//Employes”) then foreach through each element or Linq to select nodes. Xml to Linq is easier to read than XPath

Reads complete into memory – creates datatables
Read in XML document – loop through rows
Create a new DataSet then ReadXml on that object – Foreach through table’s rows. Can use search logic i.e ds.Tables[0].Select(“LastName LIKE ‘s%’);
ReadXmlSchema will validate xml against XSD.