Free Support Forum - aspose.com

Showing a positive value as negative value in excel

Hi,

I have a double value which is positive. This is a currency value. I want to show the value as negative value in the excel.

My code (c#) is like this.

double DiscountValue = new dounble();

DiscountValue = 53.25;

Aspose.Excel.Cells QuoteSummaryCells = QuoteSummarySheet.Cells;

QuoteSummaryCells.PutValue(DiscountValue);

QuoteSummaryCells.Style.Number = 7;

In the out put i want to see -$53.25 and i am using this for value for calculations (using formula).

Please advise.

Please note that my DiscountVlaue will be positive always (due to our way of implementation). But it is a disount. Hence i want to show that as a negative value in the excel alone.

thanks,

moorthi.

Hi moorthi,

Please change your line of code to:

QuoteSummaryCells.Style.Custom = "-$#,##0.00";

Thank you.

Hi Amjad,

The solution works fine.

thanks,

moorthi.