1

I am using Aspose for creating excel. I am getting few difficulties.

1st issue

Cells.importResultSet in this how to insert customDateFormatString

2nd issue

Cells.importResultSet in this how to insert customNumberFormatString

Please check the below example for number

10000 to $10,000
Janny
  • 681
  • 1
  • 8
  • 33

1 Answers1

1

1) You may put your desired custom date/time format string for the customDateFormatString parameter in Cells.importResultSet() overloaded method. See the sample line of code for your reference: e.g Sample code:

worksheet.getCells().importResultSet(rs, 0, 0, true, "d-mmm-yy", true);

2) It is better once you have imported data to Excel worksheet using Cells.importResultSet() method, you may apply your desired number formatting to the cells in the range/column accordingly, see the document for your reference: http://www.aspose.com/docs/display/cellsjava/Setting+Display+Formats+of+Numbers+and+Dates

In your case, you should set the custom number format string as "$#,##0" for your requirements.

Amjad Sahi
  • 1,813
  • 1
  • 10
  • 15
  • I tried that example. But here they talking about single cell. i like to put same style for column. – Janny Jul 17 '15 at 08:46
  • Well, you may format the whole row or column, see the document for your reference: http://www.aspose.com/docs/display/cellsjava/Formatting+Rows+and+Columns All you need to do is specify your desired Style object's options and make the relevant StyleFlag attributes on. Thanks. – Amjad Sahi Jul 17 '15 at 18:51