DelimitedCellFormatter
using Microsoft.VisualBasic.CompilerServices;
using System;
namespace kCura.WinEDDS.Exporters
{
public class DelimitedCellFormatter : ILoadFileCellFormatter
{
private ExportFile _settings;
public string RowPrefix => string.Empty;
public string RowSuffix => string.Empty;
public DelimitedCellFormatter(ExportFile settings)
{
_settings = settings;
}
public string TransformToCell(string contents)
{
contents = contents.Replace(Environment.NewLine, '\n'.ToString());
contents = contents.Replace('\r', '\n');
contents = contents.Replace('\n', _settings.NewlineDelimiter);
contents = contents.Replace(Conversions.ToString(_settings.QuoteDelimiter), Conversions.ToString(_settings.QuoteDelimiter) + Conversions.ToString(_settings.QuoteDelimiter));
return string.Format("{0}{1}{0}", _settings.QuoteDelimiter, contents);
}
string ILoadFileCellFormatter.TransformToCell(string contents)
{
return this.TransformToCell(contents);
}
public string CreateImageCell(ObjectExportInfo artifact)
{
return string.Empty;
}
string ILoadFileCellFormatter.CreateImageCell(ObjectExportInfo artifact)
{
return this.CreateImageCell(artifact);
}
public string CreateNativeCell(string location, ObjectExportInfo artifact)
{
return string.Format("{2}{0}{1}{0}", _settings.QuoteDelimiter, location, _settings.RecordDelimiter);
}
string ILoadFileCellFormatter.CreateNativeCell(string location, ObjectExportInfo artifact)
{
return this.CreateNativeCell(location, artifact);
}
public string CreatePdfCell(string location, ObjectExportInfo artifact)
{
return CreateNativeCell(location, artifact);
}
string ILoadFileCellFormatter.CreatePdfCell(string location, ObjectExportInfo artifact)
{
return this.CreatePdfCell(location, artifact);
}
}
}