Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TForm1.FormCreate(Sender: TObject);
begin
OleContainer1.CreateObjectFromFile('c:\temp\uni.xls',false);
OleContainer1.Doverb(-1);
end;
if(ext = '.TXT') or (ext = '.CSV') then
begin
CreateObject('Excel.Sheet.8',false);
ExcelApplication1 := TExContext.GetExcelApplication;
if(ext = '.TXT') then
begin
tq := xlTextQualifierNone;
tabdelim:= True;
semicdelim := False;
end
else
begin
tq := xlTextQualifierNone;
tabdelim:= False;
semicdelim := True;
end;
catf:= TCatalogueFile.Create(Filename);
with ExcelApplication1 do
try
xdf := catf.GetFieldInfo();
if (ext = '.CSV') then
begin
if CopyFile(PAnsiChar(FileName), PAnsiChar(FileName+'.TXT'), True) then
Filename:= FileName+'.TXT'
else raise Exception.Create(Format(rsCSVRenameError, [FileName+'.TXT']));
end;
// EBL: correction anomalie Excel: lorsqu'un fichier texte commence par ID,
// Excel génère une erreur (fichier SYLK invalide) et plante s'il s'agit
// d'un fichier csv
if (catf.Data.Count > 0) and (AnsiStartsStr('ID', catf.Data.Strings[0])) then
raise Exception.Create(rsSYLKError);
OleVariant(Workbooks).OpenText(Filename, xlWindows, 1,
xlDelimited, tq, False, tabdelim, semicdelim,
False, False, False, EmptyParam, xdf);
(Workbooks.Item[Workbooks.Count].Sheets.Item[1] as _worksheet).Cells.EntireRow.Copy((Workbooks.Item[Workbooks.Count -1].Sheets.Item[1] as _worksheet).Range['A1','A1']);
Workbooks.Item[Workbooks.Count].Close(False,'',EmptyParam,GetUserDefaultLCID);
if (ext = '.CSV') then
begin
catf.FileName:= LeftStr(FileName, Length(FileName)-4);
catf.Save(tfCSV);
DeleteFile(Filename);
end;
finally
VarClear(xdf);
catf.Free;
end;
OleVariant(Workbooks).OpenText(Filename, 65001, 1, xlDelimited, tq, False, tabdelim, semicdelim, False, False, False, EmptyParam, xdf);