We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to format column to display currency


I just want to display list of currencies in aspose column but currently it only recognizes the ‘$’ symbol and lists all other currency symbols as ‘?’. How can I display the appropriates symbols in the column.?

Many thanks in advance.
Hi Ashraf,

Thank you for considering Aspose APIs.

Please note that we have split the existing thread to create a new one on your behalf. Reason being, you originally posted on a very old thread (from 2008), and public API has changed a lot since then.

Regarding the original inquiry, we would like to review your code snippet (most preferably a sample application) to isolate the problem as mentioned in your post. There could also be a problem in the API if you are using an old revision of Aspose.Cells for .NET API. Anyway, please check the below provided code snippet that sets the format for 3 different currencies. Also attached resultant spreadsheet for your reference.

//Instantiating a Workbook object Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet Worksheet worksheet = workbook.Worksheets[0];
Style style = null;
//Adding a numeric value to "A1" cell worksheet.Cells["A1"].PutValue(2546);
//Getting the style of A1 cell style = worksheet.Cells["A1"].GetStyle();

//Setting the custom display format to show value as currency style.Custom = "£#,##0;[Red]-£#,##0";

//Applying the style to A1 cell worksheet.Cells["A1"].SetStyle(style);
//Adding a numeric value to "A2" cell worksheet.Cells["A2"].PutValue(2546);
//Getting the style of A2 cell style = worksheet.Cells["A2"].GetStyle();
//Setting the custom display format to show value as currency style.Custom = "$#,##0;[Red]-$#,##0";

//Applying the style to A2 cell worksheet.Cells["A2"].SetStyle(style);

//Adding a numeric value to "A3" cell worksheet.Cells["A3"].PutValue(2546);
//Getting the style of A3 cell style = worksheet.Cells["A3"].GetStyle();
//Setting the custom display format to show value as currency style.Custom = "¥#,##0;[Red]-¥#,##0";

//Applying the style to A3 cell worksheet.Cells["A3"].SetStyle(style);
//Saving the Excel file workbook.Save("D:/temp/book1.xls", SaveFormat.Excel97To2003);

Thank you for your quick response.

I am importing a csv file with different currency symbols and the symbols load up as ‘?’ rather than the symbol itself apart from the ‘$’ symbol which is the default.

 var csvStream = new MemoryStream(byteArrary);

sheet.Cells.ImportCSV(csvStream, “,”, false, 0, 0);

Hi Ashraf,

Thank you for writing back.

Please share your input & output files along with your complete code snippet. We will further investigate the matter to suggest you a solution for this situation.