public static void WriteRow(StreamWriter fw, ITableStructure table, IBedRecord record, IBedValueFormatter formatter) { fw.Write("<ss:Row>\n"); for (int i = 0; i < record.FieldCount; i++) { string sval = null; string stype = "String"; string style = ""; record.ReadValue(i); var type = record.GetFieldType(); if (type.IsDateRelated()) { stype = "DateTime"; style = " ss:StyleID=\"sDateTime\" "; } else if (type.IsNumber()) { stype = "Number"; } formatter.ReadFrom(record); sval = formatter.GetText(); //object val = record.GetValue(i); //if (val is DateTime) //{ // stype = "DateTime"; // sval = ((DateTime)val).ToString("s", CultureInfo.InvariantCulture); // style = " ss:StyleID=\"sDateTime\" "; //} //else if (val != null && val.GetType().IsNumberType()) //{ // stype = "Number"; // sval = Convert.ToString(val, CultureInfo.InvariantCulture); //} //if (sval == null) sval = XmlTool.ObjectToString(val); fw.Write("<ss:Cell {2}><Data ss:Type=\"{0}\">{1}</Data></ss:Cell>\n", stype, XmlTool.QuoteEntities(sval), style); } fw.Write("</ss:Row>\n"); }