{"id":1234,"date":"2016-01-31T10:51:11","date_gmt":"2016-01-31T02:51:11","guid":{"rendered":"http:\/\/www.vcoo.cc\/blog\/?p=1234"},"modified":"2016-01-31T10:51:11","modified_gmt":"2016-01-31T02:51:11","slug":"sql-server-export-excel-have-line-breaks","status":"publish","type":"post","link":"https:\/\/vcoo.cc\/blog\/1234\/","title":{"rendered":"SQL Server \u5bfc\u51faExcel\u6709\u6362\u884c\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u4ece SQL Server \u67e5\u8be2\u7ed3\u679c\u4e2d\u590d\u5236\u7ed3\u679c\u6570\u636e\u7c98\u8d34\u5230 Excel \u4e2d\u5b58\u5728\u8fd9\u4e48\u4e2a\u95ee\u9898\uff1a\u5982\u679c\u5b57\u6bb5\u5185\u5bb9\u4e2d\u6709\u6362\u884c\u7b26\uff0c\u90a3\u4e48\u7c98\u8d34\u5230 Excel \u4e2d\u5c31\u4f1a\u5f97\u5230\u4e0d\u662f\u6211\u4eec\u9884\u671f\u7684\u7ed3\u679c\uff0c\u5373\u539f\u6765\u4e00\u884c\u7684\u6570\u636e\u5728 Excel \u4e2d\u4ea7\u751f\u4e86\u6362\u884c\uff0c\u8fd9\u662f\u6211\u4eec\u4e0d\u60f3\u8981\u7684\uff0c\u89e3\u51b3\u65b9\u6cd5\u6709\u597d\u591a\uff0c\u8fd9\u91cc\u5fae\u9177\u63d0\u4f9b\u4e24\u79cd\u65b9\u6cd5\u3002@willcoo<\/p>\n<p><strong>SQL Server \u5bfc\u51faExcel\u6709\u6362\u884c\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u4e00\u3001\u6709\u6362\u884c\u7b26\u7684\u5b57\u6bb5\u5728 Select \u8bed\u53e5\u4e2d\u5b57\u6bb5\u540d\u524d\u540e\u6dfb\u52a0\u53cc\u5f15\u53f7\u3002<\/p>\n<pre class=\"toolbar:2 lang:tsql decode:true\">--Target \u5b57\u6bb5\u6709\u6362\u884c\u7b26\uff0c\u90a3\u4e48\u524d\u540e\u52a0\u53cc\u5f15\u53f7\u3002@willcoo\r\nselect '\"'+Target+'\"' from dbo.SCR_Subject<\/pre>\n<p>\u4e8c\u3001\u901a\u8fc7 DevExpress \u7684 GridControl \u63a7\u4ef6\u5bfc\u51fa\u3002<\/p>\n<pre class=\"toolbar:2 lang:c# decode:true \">DataTable dt=db.GetDataTable(\"select * from Table1\");\r\ngridControl1.DataSource=dt;\r\ngridControl1.ExportToXlsx(\"D:\\\\temp.xlsx\");<\/pre>\n<p>\u5176\u5b9e\u65b9\u6cd5\u8fd8\u6709\u597d\u591a\u79cd\uff0c\u8fd9\u91cc\u4e0d\u518d\u4f8b\u4e3e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece SQL Server \u67e5\u8be2\u7ed3\u679c\u4e2d\u590d\u5236\u7ed3\u679c\u6570\u636e\u7c98\u8d34\u5230 Excel \u4e2d\u5b58\u5728\u8fd9\u4e48\u4e2a\u95ee\u9898\uff1a\u5982\u679c\u5b57\u6bb5\u5185\u5bb9\u4e2d\u6709\u6362\u884c\u7b26\uff0c\u90a3\u4e48\u7c98\u8d34\u5230 Excel \u4e2d\u5c31\u4f1a\u5f97\u5230\u4e0d\u662f\u6211\u4eec\u9884\u671f\u7684\u7ed3\u679c\uff0c\u5373\u539f\u6765\u4e00\u884c\u7684\u6570\u636e\u5728 Excel \u4e2d\u4ea7\u751f\u4e86\u6362\u884c\uff0c\u8fd9\u662f\u6211\u4eec\u4e0d\u60f3\u8981\u7684\uff0c\u89e3\u51b3\u65b9\u6cd5\u6709\u597d\u591a\uff0c\u8fd9\u91cc\u5fae\u9177\u63d0\u4f9b\u4e24\u79cd\u65b9\u6cd5\u3002@willcoo<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,11],"tags":[226,307],"class_list":["post-1234","post","type-post","status-publish","format-standard","hentry","category-csharp","category-sql-server","tag-devexpress","tag-sql-server","cat-13-id","cat-11-id"],"_links":{"self":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts\/1234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/comments?post=1234"}],"version-history":[{"count":0,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts\/1234\/revisions"}],"wp:attachment":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/media?parent=1234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/categories?post=1234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/tags?post=1234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}