Rob Sherratt
Well-known member
I have started using these low-cost software libraries in my application software:
xPortTools Components
In not much more than 15 minutes I was able to create and read .xlsx and .xls files, processing these from/to a very large DataTable.
There is no linkage to any Microsoft libraries such as Microsoft Office, therefore the resulting application is completely portable and independent of Office versions.
The cost is $89 for individual libraries, or $199 for the whole set. I paid $159 for just the Excel import and Excel export libraries, since I had .csv formats sorted already.
The license allows the developer to deploy his/her software and the xporttools run-time to as many users as you wish, and there are no commercial use restrictions.
Also the level of support I have received from xporttools is fantastic, most questions receiving detailed and accurate answers within 5 minutes.
Here is "my code" for creating an .xlsx file from a very large DataTable, over 65 Mbytes in size. It took 1 second to create the .xlsx file. It is blindingly fast!
I say "my code", which is actually untrue, I just copied and pasted most of this from the support web site, where these is excellent documentation.
I stress that I am not associated with the company xporttools in any way, but I am a "happy customer" and I wanted to
let you know how good this software is. I asked Val Mazur, who is one of xporttools technical experts, if she would contribute
and provide support on this forum, and she is willing if there is sufficient interest from forum members.
xPortTools Components
In not much more than 15 minutes I was able to create and read .xlsx and .xls files, processing these from/to a very large DataTable.
There is no linkage to any Microsoft libraries such as Microsoft Office, therefore the resulting application is completely portable and independent of Office versions.
The cost is $89 for individual libraries, or $199 for the whole set. I paid $159 for just the Excel import and Excel export libraries, since I had .csv formats sorted already.
The license allows the developer to deploy his/her software and the xporttools run-time to as many users as you wish, and there are no commercial use restrictions.
Also the level of support I have received from xporttools is fantastic, most questions receiving detailed and accurate answers within 5 minutes.
Here is "my code" for creating an .xlsx file from a very large DataTable, over 65 Mbytes in size. It took 1 second to create the .xlsx file. It is blindingly fast!
I say "my code", which is actually untrue, I just copied and pasted most of this from the support web site, where these is excellent documentation.
Imports VM.xPort Imports System.IO Private Function Table_To_XLSX(MyDataTable As DataTable, FileName As String) As Boolean ' Saves a DataTable as an .xlsx file. Uses the xPortTools library ' [url=http://www.xporttools.net]xPortTools Components[/url] Try Dim xporter As VM.xPort.DS2XL Dim headerStyle As VM.xPort.Style Dim contentStyle As VM.xPort.Style Dim customFont As System.Drawing.Font Dim formatStyle As VM.xPort.Style xporter = New VM.xPort.DS2XL() 'Set columns width in 1/256th of the character's width. For example, if column 'width should be 10 characters then we set width value to 2560. ' Set all column widths to 20 characters. SetColumnWidth(xporter.ColWidths, "AllColumnWidths", MyDataTable.TableName, 0, MyDataTable.Columns.Count - 1, 20 * 256) 'Make header row higher (header's index in DataTable is -1) setting it to 25 points '(value of 1 is 1/20th of a point). SetRowHeight(xporter.RowHeights, "Header", MyDataTable.TableName, -1, -1, 60 * 20) 'Set row height for all other rows to 15 points. SetRowHeight(xporter.RowHeights, "AllRows", MyDataTable.TableName, 0, MyDataTable.Rows.Count - 1, 15 * 20) 'Define style for the header. headerStyle = New VM.xPort.Style("HeaderStyle", MyDataTable.TableName, -1, 0, -1, MyDataTable.Columns.Count - 1) 'Create font that will be used to format header text. customFont = New System.Drawing.Font("Calibri", 11, FontStyle.Bold) headerStyle.Font = customFont headerStyle.ForeColor = Color.White headerStyle.HorizontalAlignment = Style.xpHAlignment.Center headerStyle.VerticalAlignment = Style.xpVAlignment.Center headerStyle.ReadingDirection = Style.xpReadingDirection.Context headerStyle.LeftBorderLine = Style.xpBorderLineStyle.Thin headerStyle.RightBorderLine = Style.xpBorderLineStyle.Thin headerStyle.TopBorderLine = Style.xpBorderLineStyle.Thin headerStyle.BottomBorderLine = Style.xpBorderLineStyle.Thin headerStyle.BackgroundColor = Color.FromArgb(0, 36, 64, 98) headerStyle.LeftBorderColor = Color.White headerStyle.RightBorderColor = Color.White headerStyle.TopBorderColor = Color.White headerStyle.BottomBorderColor = Color.White headerStyle.WrapText = True 'Add custom style to the collection of styles. If we do not add style, it will not be applied. xporter.Styles.Add(headerStyle) 'Create style for content contentStyle = New Style("ContentStyle", MyDataTable.TableName, 0, 0, MyDataTable.Rows.Count - 1, MyDataTable.Columns.Count - 1) 'Create style for data cells customFont = New System.Drawing.Font("Calibri", 11, FontStyle.Regular) contentStyle.Font = customFont contentStyle.HorizontalAlignment = Style.xpHAlignment.Left contentStyle.VerticalAlignment = Style.xpVAlignment.Top contentStyle.ReadingDirection = Style.xpReadingDirection.Context contentStyle.LeftBorderLine = Style.xpBorderLineStyle.Thin contentStyle.RightBorderLine = Style.xpBorderLineStyle.Thin contentStyle.TopBorderLine = Style.xpBorderLineStyle.Thin contentStyle.BottomBorderLine = Style.xpBorderLineStyle.Thin contentStyle.BackgroundColor = Color.FromArgb(0, 220, 230, 241) contentStyle.LeftBorderColor = Color.White contentStyle.RightBorderColor = Color.White contentStyle.TopBorderColor = Color.White contentStyle.BottomBorderColor = Color.White contentStyle.WrapText = True 'Add custom style to the collection of styles xporter.Styles.Add(contentStyle) 'Make a clone of the contentStyle style and set only specific properties of custom style. formatStyle = contentStyle.Clone("DateValues", MyDataTable.TableName, 0, _ MyDataTable.Columns("Application Date").Ordinal, MyDataTable.Rows.Count - 1, _ MyDataTable.Columns("Application Date").Ordinal) 'Set format of the date values in specific column. 'Refer to documentation about which built-in Excel formats are available. ' Use custom (not built-in) format string. formatStyle.FormatIndex = VM.xPort.Style.xpFormat.Custom formatStyle.Format = "MMM dd, yyyy" 'Add custom style to the collection of styles. xporter.Styles.Add(formatStyle) xporter.Export(MyDataTable, FileName, xpOutputFormat.XLSX, True, True) Return True Catch ex As Exception ' In place of "PrintLine" use your favorite text output method. PrintLine(ex.ToString()) Return False End Try End Function Private Sub SetColumnWidth(ByVal widths As ColWidthCollection, _ ByVal styleName As String, _ ByVal dataTableName As String, _ ByVal startCol As Integer, _ ByVal endCol As Integer, _ ByVal width As Integer) Dim customColumnWidth As ColWidth customColumnWidth = New ColWidth(styleName, dataTableName, startCol, endCol, width) widths.Add(customColumnWidth) End Sub Private Sub SetRowHeight(ByVal heights As RowHeightCollection, _ ByVal styleName As String, _ ByVal dataTableName As String, _ ByVal startRow As Integer, _ ByVal endRow As Integer, _ ByVal height As Integer) Dim customRowHeight As RowHeight customRowHeight = New RowHeight(styleName, dataTableName, startRow, endRow, height) heights.Add(customRowHeight) End Sub
I stress that I am not associated with the company xporttools in any way, but I am a "happy customer" and I wanted to
let you know how good this software is. I asked Val Mazur, who is one of xporttools technical experts, if she would contribute
and provide support on this forum, and she is willing if there is sufficient interest from forum members.
Last edited: