I have the following method in an app I inherited:
public static void ExportToExcel(string filename, System.Data.DataSet ds) { if (ds != null) {<SPAN style="COLOR: blue">string</SPAN> licensefile = <SPAN style="COLOR: #2b91af">WebHelper</SPAN>.GetAppSettingsValue(<SPAN style="COLOR: #2b91af">AppsettingKeys</SPAN>.AsposeLicenseFile); <SPAN style="COLOR: #2b91af">License</SPAN> license = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">License</SPAN>(); license.SetLicense(licensefile); <SPAN style="COLOR: #2b91af">WorkbookDesigner</SPAN> workBookDesigner = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WorkbookDesigner</SPAN>(); <SPAN style="COLOR: blue">try</SPAN> { <SPAN style="COLOR: blue">string</SPAN> templateFile = <SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #a31515">"{0}Distribution.xls"</SPAN>, <SPAN style="COLOR: #2b91af">HttpContext</SPAN>.Current.Request.PhysicalApplicationPath); <FONT color=#ff0000>workBookDesigner.Workbook.Open(templateFile);</FONT> workBookDesigner.SetDataSource(ds); workBookDesigner.Process(); workBookDesigner.Workbook.Worksheets[0].AutoFitColumns(); workBookDesigner.Workbook.Save(<SPAN style="COLOR: #2b91af">HttpContext</SPAN>.Current.Response, filename, <SPAN style="COLOR: #2b91af">ContentDisposition</SPAN>.Inline, <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">XlsSaveOptions</SPAN>(<SPAN style="COLOR: #2b91af">SaveFormat</SPAN>.Excel97To2003)); } <SPAN style="COLOR: blue">catch</SPAN> (<SPAN style="COLOR: #2b91af">Exception</SPAN> ex) { <SPAN style="COLOR: blue">throw</SPAN> ex; } <SPAN style="COLOR: blue">finally</SPAN> { workBookDesigner = <SPAN style="COLOR: blue">null</SPAN>; ds.Dispose(); } } }</PRE>
I'm getting a message that "workBookDesigner.Workbook.Open(templateFile)" is deprecated and I should use the Workbook(filename) constructor. I can't however find any documentation on binding a dataset to a Workbook or WorkbookDesigner. Any help on updating this code would be greatly appreciated.