Posts

Showing posts from October, 2013

How to create a chart using Open XML SDK in Word 2010

Creating a Chart in Open involves two steps, as the data is stored at two locations.  Chart Cache Embedded Package - This is nothing but an Excel Sheet Thus, populating the data in Cache is not enough. We should also create corresponding Excel Sheet. Below is the sample code. The code is verbose as I was using Open XML productivity tool to arrive at this. Full source code can be found at  https://github.com/pradeepkumargali/GenerateWord-OpenXML   Main Class: ChartPart chartPart2 = mainDocumentPart1.AddNewPart<ChartPart>("rId7"); GenerateChartPart2Content(chartPart2); //Used to generate a dummy excel sheet out of a predefined blob - Look at "private string embeddedPackagePart2Data" EmbeddedPackagePart embeddedPackagePart2 = chartPart2.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId1"); GenerateEmbeddedPackagePart2Content(embe

Chatter Unfollow Test Class Failures

Recently, we noticed all test failures in one of our test classes. The test class was written in 19.0. The problem being SOQL's were not returning records and all the assertions were failing.  Assertion Failed: Expected: 2, Actual: 0 The fix turned out to be very simple. We fixed the error by updating the APEX class version to 29.0