Click here to Skip to main content
12,890,294 members (47,303 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
I am creating excel file and show the data by datatable fetch by c# code to sql server. the data is comming in non formated type like -1 ,1.23,1.3,3.5,4,6
i want to show it in the same format like

my code is here

HSSFWorkbook workBook = new HSSFWorkbook();
var sheet = workBook.CreateSheet("OverAll");
                       var rowIndex = 2;

var avgCellFormate = workBook.CreateDataFormat();
                        var dataFormate = avgCellFormate.GetFormat("0.00");
                        var avgCellStyle = workBook.CreateCellStyle();
                        avgCellStyle.DataFormat = dataFormate;

row14Cells = row14.CreateCell(2);
                               row14Cells.CellStyle = avgCellStyle;

Please give me Solution.
Posted 3-Oct-12 2:19am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 14 Jun 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100