General question re: exporting from a DataTable

Hi,

I was pointed your way by an article I read online.

I’m running some queries in SQL Server 2000, which eventually make their way into a .Net DataSource. For instance, here’s a brief code snippet in VB .Net:

’’’’’’’’’’’’’’’’’’’’’’’’’’’’
DA = New SqlDataAdapter(“select * from mytable”, Con)
Dim DS As New DataSet
DA.Fill(DS, “Customers”)
’’’’’’’’’’’’’’’’’’’’’’’’’’’'
Nothing too fancy. My boss needs me to export the above “Customers” DataTable to Excel.

I don’t need custom cell formatting or resizing of columns or macros added in; just the data, each column in the DataTable mapping to a similarly-named column in the spreadsheet.

My XSL skills are terrible, and I’d love avoid streaming my DataTables to XML and manipulating them from there. Also, my DataSource will hold multiple DataTables before long, and I’d like for those to go into separate tabs on the same spreadsheet; is this possible with Aspose.Excel?

Finally, I’ll be running all this from a .Net executable on my box. I assume this counts as an “internal” license at $270 US? What if I wanted to add an extra workstation or two to the list-- how much extra is that, $270 per box?

Thanks for your help.




It’s easy to import a DataTable to Excel using Aspose.Excel. You can use the Cells.ImportDataTable method to do it.

Following is the sample code:

Dim ExcelObject as Excel = new Excel()
Dim Sheets as Worksheets = ExcelObject.Worksheets
Dim Sheet as Worksheet
Dim Cells as Cells
Dim MyTable As DataTable
Dim SheetIndex as Integer = 0
For Each MyTable in DS.Tables
Sheet = Sheets(SheetIndex)
Cells = Sheet.Cells
Cells.ImportDataTable(MyTable, true, 0, 0)
SheetIndex = Sheets.Add()
Next MyTable

I’m addressing the question:


Finally, I’ll be running all this from a .Net executable on my box. I assume this counts as an “internal” license at $270 US? What if I wanted to add an extra workstation or two to the list-- how much extra is that, $270 per box?


“Internal” means the Aspose.Excel.dll will be deployed with your Windows application to machines used internally within your organization. If this is the case you do not pay any extra bucks when you need to deploy it to more internal machines. Anyway please let me know more details about your licensing needs then I can sort the pricing out for you.