English 中文(简体)
导出网格视图优于 gidview 的所有格式格式化
原标题:Export gridview to excel with all formatting of gidview
  • 时间:2012-05-25 18:49:23
  •  标签:
  • c#
  • asp.net

I need to export gidview to excel with all gridview s formatting applied. I do not have any controls inside my gridview, all style applied. is there any options available?

问题回答

我认为这是你最好和最容易的赌注:http://www.gembox software.com/Spetesh/overview

var bindingSource = (BindingSource)this.peopleDataGridView.DataSource;
var dataTable = ((DataView)bindingSource.List).Table;
var ef = new ExcelFile();
var ws = ef.Worksheets.Add(dataTable.TableName);
// Insert data table in worksheet, starting from worksheet s first row and column and    include column headers
ws.InsertDataTable(dataTable, 0, 0, true);

foreach(ExcelCell cell in ws.GetUsedCellRange(true))
   cell.Style.FillPattern.SetSolid(Color.Red);
ef.SaveXls(dataTable.TableName + ".xls");

另一个选项是使用“http://www.completit.com/Portfolio/DGVE/Screenshots.aspx” rel=“no follow”>http://www.com/com/Portfollio/DGVE/Screenshots.aspx

[Added 1 more ] This one converts DGV to XML/XSL which is the best, if you want to manipulate data in HTML or other format along with EXCEL. http://www.carlosag.net/Tools/ExcelXmlWriter/

以上所有内容均从DGV向EXCEL自由出口格式。

我不确定你的要求 但你可以试试这个控制:

< a href=> "http://exporttoexcel.codeplex.com/" rel="no follow" >ExportToExcel

您需要设定一个名为 ApptStyleInExcel 的属性为真 。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签