Finally, I am able to spell the real name for the next version of Office: 2007 Microsoft® Office system.
For those of you who have not seen the press passes and want to catch-up here is a list with some of them:
- FAQ: Looking into Office 12
- Does "Office 12" equal Office 2007?
- Microsoft announces Office 2007 pricing, details
Maybe you have heard that this is the biggest release of the decade, and I can tell you that this version of Office has great potential as a development platform. Lots of features/enhancements were announced on Beta 1 and for Beta 2 there are more cool surprises waiting to be announced.
My latest experiment with 2007 Microsoft® Office 🙂 is exporting an ASP.NET 2.0 GridView to Excel 2007. If you use the following code snippet, you will be able to export the content of a SqlDataSource (used to DataBind a GridView) to Excel (without automation):
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
GridView grid = new GridView();
grid.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty);
grid.AutoGenerateColumns = true;
We built a Web based application for MSDN content management, and we export reports to Excel 2003 using the previous snippet of code. One thing that we don't like is that we lose all formatting, so we have the data, but then we have to make it pretty again.
I ran the same process on a machine where I have the last build of 2007 Microsoft® Office and Excel 2007 is smart enough to keep my formatting. Another cool enhancement. For those of you who have Beta 1, please give it a try.