Hi,
I'm trying to open a txt file and convert it to an Excel File.
Everything goes right but when I try to set the format of the cells (parameters FieldInfo of the openTxt mehtod - 13) it doesn't work.
It has to be an Array but I tryied a lot of unsuccefull combinations.
Can anyony help me?
This is my code :
#Excel
SysExcelApplication excel;
SysExcelWorkBooks books;
Filename excelFileName;
Filename csvFileName;
ComVariant arrayCOM = new ComVariant();
container cont;
int i, result;
COM com;
;
csvFileName = '\\\route\\File.txt';
excelFileName = '\\\\route\\Test.xls';
excel = SysExcelApplication ::construct( );
excel.displayAlerts (false);
// Insert 10 values in the array
for (i = 1; i <= 10; i++)
{
cont = conins(cont,i,2);
}
arrayCOM.container(cont);
books = excel.workbooks( );
books.comObject().openText(csvFileName, //1 - Filename
#xlWindows, //2 - Origin
1, //3 - StartRow
1, //4 - DataType
1, //5 - TextQualifier
false, //6 - ConsecutiveDelimiter
false, //7 - Tab
false, //8 - Semicolon
false, //9 - Comma
false, //10 - Space
true, //11 - Other
"|", //12 - Other Char
arrayCOM); //13 - FieldInfo (xlTextFormat)
books.item(1).saveAs(excelFileName);
excel.quit() ;