Hi,
Currently I have a method that opens an excel file (.xls/.xlsx), applies different styles to different rows/columns and then saves the file with each row of data being separated by a delimiter ("~").
The excel file will have the first row consist of headings, then the second row and beyond be data rows. Such as (first row): "Name Data1 Data2 Data3", then (second row): "Row1 2.345 3.145 6.422"
When the file saves, the first row and all subsequent data rows are correctly delimited with a "~". So the first two rows look like this: (first row): "Name~Data1~Data2~Data3" and (second row): "Row1~2.345~3.145~6.422". However, there are always a total of around 10,000+ rows in the file that are just "~ ~ ~"...which I dont know how to get rid of.
My code just looks like this:
LoadFormat lf = LoadFormat.Excel97To2003;
//Creating a Workbook object
LoadOptions loadOptions = new LoadOptions(lf);
Workbook workbook = new Workbook(sFileName, loadOptions);
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
sSheetName = worksheet.Name;
do {
//Here we have a code block that sets style/display formats for various cells
} while (worksheet.Cells[iRow, iCol].Value != null);
TxtSaveOptions options = new TxtSaveOptions();
options.Separator = Convert.ToChar("~");
workbook.Save(sFileName, options);
Thanks.