Hello,
I found sample code to display currency data in cells. The problem is that the data always displays in $ eventhought the culture setting in my browser is set to en-GB. Can you please let me know how to make my code to display the data with the Euro sign in front? I need to display the first column - cells.Columns[0] in currency format. Below is my code:
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(this.Request.UserLanguages[0]);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.Request.UserLanguages[0]);
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.Name = "show currency";
string _SaveAsFileName = SaveAsFileName + ".xls";
//Obtain the cells of the first worksheet.
Cells cells = workbook.Worksheets[0].Cells;
//Adding a new Style to the styles collection of the Excel object
workbook.Styles.Add();
workbook.Styles.Add();
workbook.Styles.Add();
//Accessing the newly added Style to the Excel object
Aspose.Cells.Style styleCurrency = workbook.Styles[0];
Aspose.Cells.Style styleDates = workbook.Styles[1];
Aspose.Cells.Style styleTitles = workbook.Styles[2];
styleCurrency.Number = 15;
styleDates.Custom = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern.ToLower();
styleTitles.HorizontalAlignment = TextAlignmentType.Center;
styleTitles.Font.Color = System.Drawing.Color.Blue;
//Accessing a column from the Columns collection
Column columnCurrency = cells.Columns[0];
Column columnDates = cells.Columns[3];
//Assigning the Style object to the Style property of the column
columnCurrency.Style = styleCurrency;
columnDates.Style = styleDates;
////Accessing a row from the Rows collection
//Row row = cells.Rows[0];
////Assigning the Style object to the Style property of the row
//row.Style = style;
//Row rowTitle = cells.Rows[0];
//rowTitle.Style = styleTitles;
sheet.Cells["A1"].PutValue(salary);
sheet.Cells["B1"].PutValue(lastname);
sheet.Cells["C1"].PutValue(firstname);
sheet.Cells["D1"].PutValue(hiredate);
sheet.Cells["E1"].PutValue(active);
sheet.Cells["F1"].PutValue(usertypeid);
sheet.Cells["G1"].PutValue(deptid);
sheet.Cells["H1"].PutValue(MI);
sheet.Cells["A1"].Style.HorizontalAlignment = TextAlignmentType.Center;
// sheet.Cells.Columns[0].Style.Custom = Functions.getDateFormatString(this.Page);
sheet.Cells.ImportDataTable(dtData, false, "A2");
sheet.AutoFitColumns();
workbook.Save(_SaveAsFileName, FileFormatType.Default, Aspose.Cells.SaveType.OpenInExcel, this.Response);
Thank you very much in advance for your help.