开发者

What is the easiest way to display a DataTable as TSV?

开发者 https://www.devze.com 2023-01-04 07:30 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号