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

Free Support Forum - aspose.com

Excel requirements

I’ve requirement like sheet has zero values and negative values -

for zero it needs to converted into hyphen (-)
and for negative parantheses with red color

And one more query - How to give $ value to specific row in aspose cells.


This Topic is created by Amjad_Sahi using Email to Topic tool.


Well, you may apply formattings (e.g numbers formatting) to your desired sheet cells using Aspose.Cells APIs. See the document on how to apply different display formats to a cell, a row, a column, etc.

Especially for your tasks, you may try referring to the sub-topic “Using Custom Number Formats” with example. We recommend you to kindly open a new Workbook into MS Excel manually and add some data to the cells, now apply your desired (custom) formatting in a cell. Now use same custom string when performing the task via Aspose.Cells APIs in code.

If you still find any issue, kindly do attach your expected file with your desired formatting (you may create the file into MS Excel manually) and attach it, we will check and help you on how to do it via Aspose.Cells APIs.

PS. please zip the file prior attaching.

Hi Amjad,

Thanks for the information.

I’ve to apply this “$ #,##0_);[Red]($ #,##0);($ * “-”);(@)” custom format for my sheet.

Could you please help.



See the following sample code to accomplish the task for your reference:
Sample code:

 var _wb = new Workbook();

            var _ws = _wb.Worksheets[0];
            var _cell = _ws.Cells[0, 0];
            var _style = _cell.GetStyle();
            _style.Custom = "$ #,##0_);[Red]($ #,##0);($ * \" - \");(@)";

            _wb.Save("e:\\test2\\out1.xlsx", SaveFormat.Xlsx);

Hope, this helps a bit.