Add custom header and export datatable to Excel

Nov 2, 2012 at 3:46 PM

Hello, I was wondering if there was a way to add a custom header over a few rows (example B1:D1) and then have the rest of the worksheet populated with a datatable (including the column headers from the datatable - these would appear on A2:E2).

Here is an example of my code (dt is a datatable populated earlier in the code and fileNme is a variable set earlier as well) 

wb.AddWorksheet(dt, "Sheet1")

wb.SaveAs(fileNme)

Thanks much!  Heather

P.S. Thanks for such a great product.  This is very helpful.

 

Coordinator
Nov 2, 2012 at 3:55 PM

Create the worksheet, add the header, and then use cell.InsertTable

Nov 3, 2012 at 11:11 AM
Thanks that did it!


On Nov 2, 2012, at 10:58 AM, "MDeLeon" <notifications@codeplex.com<mailto:notifications@codeplex.com>> wrote:


From: MDeLeon

Create the worksheet, add the header, and then use cell.InsertTable

Read the full discussion online<http://closedxml.codeplex.com/discussions/401698#post935766>.

To add a post to this discussion, reply to this email ([email removed]<mailto:[email removed]?subject=[closedxml:401698]>)

To start a new discussion for this project, email [email removed]<mailto:[email removed]>

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe<https://closedxml.codeplex.com/discussions/401698/unsubscribe/> on CodePlex.com<http://CodePlex.com>.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com<http://CodePlex.com>