用数字格式导出数据表格到excel表格

我需要导出一个数据集:

DataSet ds = new DataSet("tabless"); ds.Tables.Add(table01); ds.Tables.Add(table02); ds.Tables.Add(table03); 

它包含3个数据表,每个表是:

 table01.Columns.Add("Branch",typeof(string)); table01.Columns.Add("Today", typeof(double)); table01.Columns.Add("MTD",typeof(double)); table01.Columns.Add("LM",typeof(double)); table01.Columns.Add("Differ",typeof(double),"LM-MTD"); table01.Columns.Add("YTD",typeof(double)); 

所以我需要将它们导出到数字格式和逗号分隔符的Excel工作表。
就像价值= -200000时(200,000)红色,价值300000时300,000,并将其应用于工作表中的每个表格。 欲了解更多信息请查看下面的照片:

截图http://postimg.org/image/lj55lz6ib/

你可以使用NumberingFormat

  //Create a NumberingFormat NumberingFormat numForm2decim = new NumberingFormat(); numForm2decim.NumberFormatId = 1u; numForm2decim.FormatCode = StringValue.FromString("0.00"); //Use it in a CellFormat CellFormat cellformatNumber2Decim = new CellFormat(); cellformatNumber2Decim.NumberFormatId = numForm2decim.NumberFormatId; cellformatNumber2Decim.ApplyNumberFormat = true; //And apply the cellFormat to your Cell throw the StyleIndex Property