none
keeping cell format while building excel reports from template using OpenXML RRS feed

  • Question

  • I want to build reports from a nice formatted excel template. However, running into a problem with formatting.

    In my template, I have specfic formatting for entire columns already set, such as DD/MM/YYYY HH:MM,  Number, Percentage, etc., and those are used in conditional formatting, charting, and other dependent objects.

    Now from C# OpenXML API, I just want to populate those columns with data. I do not want to do any formatting or styling. Now, I follow the example from http://msdn.microsoft.com/en-us/library/office/hh180830(v=office.14).aspx, and insert string values in those columns. 

    The problem is that it erases column formatting and entire spreadsheet is messed up because other objects such as charts are dependent on each column format. Now how do I insert a value into the spreadsheet from C# OpenXML while preserving column formatting. Again, I do not want to worry about formatting within C# at all as that might change.

    thanks

    Saturday, November 17, 2012 4:39 AM

Answers