Exemple #1
0
        private void SaveFile(string filename, SharpRowWriter rowWriter, Encoding encoding = null)
        {
            Helpers.Net.Extensions.IO.TryCreateDirectory(Path.GetDirectoryName(filename));

            using (var dest = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
            {
                using (var writer = rowWriter(dest, _nodes, encoding ?? _defaultEncoding))
                {
                    writer.Write(_rows.GetRows());
                }
            }
        }
Exemple #2
0
        private string SaveString(SharpRowWriter rowWriter, Encoding encoding = null)
        {
            using (var dest = new MemoryStream())
            {
                var enc = encoding ?? _defaultEncoding;
                using (var writer = rowWriter(dest, _nodes, enc))
                {
                    writer.Write(_rows.GetRows());
                }

                return(enc.GetString(dest.GetBuffer()));
            }
        }