日期:2014-05-17 浏览次数:20903 次
for (int i=2;i<=FileName.Length+1;i++)
{
newSheet = newExcel.ActiveSheet;
newSheet.QueryTables.Add("TEXT;"+FilePath[i-2],newSheet.get_Range("$A$1"),nothing);
//newSheet.QueryTables[i-1].Name = FileName[i-2];
newSheet.QueryTables[i-1].FieldNames = true;
newSheet.QueryTables[i-1].RowNumbers = false;
newSheet.QueryTables[i-1].FillAdjacentFormulas = false;
newSheet.QueryTables[i-1].PreserveFormatting = true;
newSheet.QueryTables[i-1].RefreshOnFileOpen = false;
newSheet.QueryTables[i-1].RefreshStyle = MSExcel.XlCellInsertionMode.xlInsertDeleteCells;
newSheet.QueryTables[i-1].SavePassword = false;
newSheet.QueryTables[i-1].SaveData = true;
newSheet.QueryTables[i-1].AdjustColumnWidth = true;
newSheet.QueryTables[i-1].RefreshPeriod = 0;
newSheet.QueryTables[i-1].TextFilePromptOnRefresh = false;
newSheet.QueryTables[i-1].TextFilePlatform = 936;
newSheet.QueryTables[i-1].TextFileStartRow = 1;
newSheet.QueryTables[i-1].TextFileParseType = MSExcel.XlTextParsingType.xlDelimited;