BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Currency Format | Accounting Format |
$250.00 | $ 250.00 |
<Grid>
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
. . .
.Mappers(map => map.ExportToExcelAction("/Grid/ExportToExcel"))
.ClientSideEvents(e => e.QueryCellInfo("QueryCellInfo"))
.Columns(col =>
{
. . . col.Field("CurrencyFormat").HeaderText("CurrencyFormat").TextAlign(TextAlign.Right).Format("{0:C}").Width(25).Add();
col.Field("AccountingFormat").HeaderText("AccountingFormat").TextAlign(TextAlign.Left).Width(75).Format("{0:C}").Add();
})
)
<Oureycell info event>
<script type="text/javascript">
function QueryCellInfo(args) {
if (args.column.field == "AccountingFormat")
{
var text = args.text;
var symbol = text.charAt(0);
var value = text.split('$').join('');
var accountFormat = symbol + " "+" " + value;
args.cell.innerHTML = accountFormat; //Customize the cell text
}
}
</script> |
<Export method>
public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
var DataSource = ord;
var count = ord.Count;
GridProperties gridProperty = (GridProperties)Utils.DeserializeToModel(typeof(GridProperties), GridModel);
. . .
IWorkbook book = exp.Export(gridProperty, ord, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron", true);
book.ActiveSheet.Range[1, 4, count,4].NumberFormat = "$ #,##0.00"; //Customize the formatting for account formatting and here range specifices [int row, int column, int lastRow, int column]
book.SaveAs("Export.xlsx", ExcelSaveType.SaveAsXLS, System.Web.HttpContext.Current.Response, ExcelDownloadType.Open);
}
|
public void ExportToExcel(string GridModel)
{
. . .
GridProperties gridProperty = (GridProperties)Utils.DeserializeToModel(typeof(GridProperties), GridModel);
GridExtensions ext = new GridExtensions();
AutoFormat auto = new AutoFormat();
ext.SetTheme(auto, "flat-saffron");
auto.FontFamily = "Arial Narrow"; //Customize the formatting while grid exporting
auto.ContentBorderColor = Color.Brown; //Customize the formatting while grid exporting
auto.ContentFontSize = 11; //Customize the formatting while grid exporting
auto.GCaptionBorderColor = Color.Cornsilk; //Customize the formatting while grid exporting
auto.GContentFontColor = Color.DarkBlue; //Customize the formatting while grid exporting
auto.HeaderFontSize = 12; //Customize the formatting while grid exporting
auto.HeaderBorderColor = Color.Red; //Customize the formatting while grid exporting
auto.ContentBgColor = Color.Wheat; //Customize the formatting while grid exporting
auto.GHeaderBgColor = Color.Crimson; //Customize the formatting while grid exporting
auto.AltRowBgColor = Color.LightCyan; //Customize the formatting while grid exporting
gridProperty.AutoFormat = auto;
IWorkbook book = exp.Export(gridProperty, ord, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron", true);
book.ActiveSheet.Range[1, 4, count,4].NumberFormat = "$ #,##0.00"; //Customize the formatting for account formatting
book.SaveAs("Export.xlsx", ExcelSaveType.SaveAsXLS, System.Web.HttpContext.Current.Response, ExcelDownloadType.Open);//Export the Grid
} |
ShowSummary() .SummaryRow(row => { row.TitleColumn("Cliente").Title("Total MXN:").SummaryColumns(col => { col.SummaryType(SummaryType.Sum) .Format("{0:C2}") .DisplayColumn("BalanceRemainingHomeCurrency") .DataMember("BalanceRemainingHomeCurrency") .Add(); }).Add(); row.ShowTotalSummary(false).ShowCaptionSummary(true).SummaryColumns(col => { col.SummaryType(SummaryType.Sum) .Format("{0:C2}") .DisplayColumn("BalanceRemainingHomeCurrency") .DataMember("BalanceRemainingHomeCurrency") .Add(); }).Add(); }) |