Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 0bcac887 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

VectoCSVFile: changed write method (added own case for ConvertedSI formatting)

parent 636eb36f
No related branches found
No related tags found
No related merge requests found
...@@ -222,10 +222,19 @@ namespace TUGraz.VectoCore.Utils ...@@ -222,10 +222,19 @@ namespace TUGraz.VectoCore.Utils
var items = row.ItemArray; var items = row.ItemArray;
var formattedList = new string[items.Length]; var formattedList = new string[items.Length];
for (var i = 0; i < items.Length; i++) { for (var i = 0; i < items.Length; i++) {
var si = items[i] as SI;
formattedList[i] = si != null if (items[i] is SI) {
? columnFormatter[i](si) formattedList[i] = columnFormatter[i]((SI)items[i]);
: formattedList[i] = string.Format(CultureInfo.InvariantCulture, "{0}", items[i]); //}
//else if (items[i] is ConvertedSI)
//{
// // todo mk-2017-10-02: maybe we also have to use decimals and showUnit from columnFormatter here?
// formattedList[i] = items[i].ToString();
} else {
formattedList[i] = string.Format(CultureInfo.InvariantCulture, "{0}", items[i]);
}
// if a string contains a "," then it has to be contained in quotes in order to be correctly recognized in a CSV file.
if (formattedList[i].Contains(Delimiter)) { if (formattedList[i].Contains(Delimiter)) {
formattedList[i] = string.Format("\"{0}\"", formattedList[i]); formattedList[i] = string.Format("\"{0}\"", formattedList[i]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment