<ej:Grid ID="OrdersGrid" runat="server" Locale="ca-ES" OnServerWordExporting="OrdersGrid_ServerWordExporting" OnServerPdfExporting="OrdersGrid_ServerPdfExporting" OnServerExcelExporting="OrdersGrid_ServerExcelExporting" AllowPaging="True">
<ToolbarSettings ShowToolbar="true" ToolbarItems="excelExport,wordExport,pdfExport"></ToolbarSettings>
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" />
<ej:Column Field="CustomerID" HeaderText="Customer ID" />
<ej:Column Field="EmployeeID" HeaderText="Employee ID" />
<ej:Column Field="Freight" HeaderText="Freight" Format="{0:N}" />
</Columns>
</ej:Grid>
protected void OrdersGrid_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
{
ExcelExport exp = new ExcelExport();
exp.Export(OrdersGrid.Model, (IEnumerable)OrdersGrid.DataSource, "Export.xlsx", ExcelVersion.Excel2010, true, true, "flat-lime");
} |
<head runat="server">
<link rel='nofollow' href="Content/ej/web/flat-lime/ej.widgets.all.min.css" rel="stylesheet" />
. . .
<script src="Scripts/ej/ej.web.all.min.js"></script>
<script src="Scripts/ej/ej.culture.ca-ES.min.js"></script>
<script src="Scripts/ej/ej.webform.min.js"></script>
</head> |
protected void OrdersGrid_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
{
ExcelExport exp = new ExcelExport();
OrdersGrid.Model.ServerExcelQueryCellInfo = querycell;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ca-ES");
exp.Export(OrdersGrid.Model, (IEnumerable)OrdersGrid.DataSource, "Export.xlsx", ExcelVersion.Excel2010, true, true, "flat-lime");
}
public void querycell(object sender)
{
var data = (IRange)sender;
if (data.Column == 3) //Frieght or numeric column
{
data.NumberFormat = "#.##0,00";
}
} |