What is the easiest way to display a DataTable as TSV?
I have a DataTable
of data from an Access database that I need to display in a <textarea>
as tab-delimited text. My first thought was just using a Repeater
and use the ItemTemplate
to format the row, but the issue is that Visual Studio will automatically convert tab characters to a set of ordinary spaces. Is there some way to get around this? Or is there a better way to开发者_Python百科 achieve this?
Set your text area to runat server and in your code behind create a string with fixed width columns as the content. Look into padleft and padright.
The HTML renderer will almost certainly convert the tabs into spaces on the client side in any case.
An HTML table when copied and pasted into most spreadsheet applications will convert the cells automatically, so it is a matter of what you are trying to achieve.
精彩评论