Hello,
I am trying to convert delimited .txt files into .xlsx but the output contains an inside space after each character.
Below is the code and attached you can find 2 sample files.
Thank you!
Tudor
static void Main(string[] args)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\g17566\Desktop\Test Validation");
FileInfo[] Files = dinfo.GetFiles("*.txt");
foreach (FileInfo file in Files)
{
Workbook workbook = new Workbook();
workbook.LoadFromFile(file.FullName, "|");
Worksheet sheet = workbook.Worksheets[0];
CellRange usedRange = sheet.AllocatedRange;
usedRange.IgnoreErrorOptions = IgnoreErrorType.NumberAsText;
usedRange.AutoFitColumns();
usedRange.AutoFitRows();
workbook.SaveToFile(file.FullName.Replace(".txt","")+".xlsx", ExcelVersion.Version2013);
}
stopwatch.Stop();
TimeSpan ts = stopwatch.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds / 10);
Console.WriteLine("RunTime " + elapsedTime);
Console.ReadLine();
}