Hi,
I am using Infragistics Excel to Export my dataset into multiple worksheets. I am having few currency fields in the Dataset , which i want to format(Ex., 1,00,000)
At present its returning without any format. Please lemme know how to do formatting for those columns.
Attached herewith the code
protected void lnkExport_Click(object sender, EventArgs e) { DataSet dsData = null; string[] Sheets = { "Sheet1", "Sheet2" };
dsData = //Returns a dataset if (dsData.Tables.Count > 1) { int i = 0; int j = 0; Workbook workbk = new Workbook(); WebExcelExporter objExcelExporter = new WebExcelExporter(); WebControl[] prm = new WebControl[dsData.Tables.Count]; objExcelExporter.ExportMode = Infragistics.Web.UI.GridControls.ExportMode.Custom; objExcelExporter.DownloadName = "Archives";
for (i = 0; i < dsData.Tables.Count; ) { workbk.Worksheets.Add(ArchiveSheets[i].ToString()); i++; }
foreach (DataTable dt in dsData.Tables) { WebDataGrid wdg = new WebDataGrid(); wdg.AutoGenerateColumns = true; wdg.StyleSetName = "Caribbean"; wdg.DataSource = dt; wdg.DataBind(); this.Controls.Add(wdg); if (i > j + 1) { objExcelExporter.Export(wdg, workbk.Worksheets[j]); }
else { objExcelExporter.ExportMode = Infragistics.Web.UI.GridControls.ExportMode.Download; objExcelExporter.Export(wdg, workbk.Worksheets[j]); }
//workbk.Worksheets.Add(HoldingsSheets[i].ToString()); //prm[i] = this.GetWebDataGrid(dsReportData.Tables[i],HoldingsSheets[0].ToString() ); j++; }
} }
H,
I'm just checking if you still need assistance with the matter.
Hello,
I'd suggest you try setting FormatString for the column you want to format. You can do this through the Worksheet, for example:
Worksheet.Columns[0].CellFormat.FormatString = "00,00,000";
Please let me know if this helps.