diff --git a/src/Libraries/DSOffice/CSVNodes.cs b/src/Libraries/DSOffice/CSVNodes.cs
index 45b22ff930b..4f4e8c31f52 100644
--- a/src/Libraries/DSOffice/CSVNodes.cs
+++ b/src/Libraries/DSOffice/CSVNodes.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using DSOffice.Properties;
namespace DSOffice
{
@@ -20,20 +21,30 @@ public static partial class Data
/// write,text,file
public static void ExportCSV(string filePath, object[][] data)
{
- using (var writer = new StreamWriter(DSCore.IO.FileSystem.AbsolutePath(filePath)))
+ try
{
- foreach (var line in data)
+ using (var writer = new StreamWriter(DSCore.IO.FileSystem.AbsolutePath(filePath)))
{
- int count = 0;
- foreach (var entry in line)
+ foreach (var line in data)
{
- writer.Write(entry);
- if (++count < line.Length)
- writer.Write(",");
+ int count = 0;
+ foreach (var entry in line)
+ {
+ writer.Write(entry);
+ if (++count < line.Length)
+ writer.Write(",");
+ }
+ writer.WriteLine();
}
- writer.WriteLine();
}
}
+ catch (Exception ex)
+ {
+ if (ex is DirectoryNotFoundException)
+ throw new Exception(Resources.StreamWriterNotFoundException);
+ else
+ throw;
+ }
}
///
diff --git a/src/Libraries/DSOffice/DSOffice.csproj b/src/Libraries/DSOffice/DSOffice.csproj
index d01d11d7444..3041e7addb3 100644
--- a/src/Libraries/DSOffice/DSOffice.csproj
+++ b/src/Libraries/DSOffice/DSOffice.csproj
@@ -26,6 +26,11 @@
+
+ True
+ True
+ Resources.resx
+
@@ -53,6 +58,15 @@
CoreNodes
+
+
+ ResXFileCodeGenerator
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+