Avatar of Nayel
Nayel asked on

Read HTML files - delphi

Dear reader,

I have an external program which is making reports. The information of these reports are saved in a directory as .call and .tel files.  They are HTML files I think.

How can I read these information to put them in a database?

Can anyone help?
Programming Languages-OtherPascal

Avatar of undefined
Last Comment
BdLm

8/22/2022 - Mon
wd123

Can you attach this files ?
dbrunton

Try opening them up using a text editor such as Notepad.  If you can see the text it's quite possible that they are HTML.  Cut and paste the first three lines of a typical file here.
BdLm

you may put them in a BLOB field using the following code :
(I do this for XML Files)  

https://www.experts-exchange.com/Programming/Languages/Pascal/Q_23333986.html
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER
Nayel

BdLm,

Then change the .xml to .html?
BdLm

BdLm

just change xml to html may be a bit to less change, as I assume MSXML will create troubles with HTML files, they are no XML .-)  (But please try)

proposal: open the files with the Twebbroswer and then stream the content to the BLOB field
 
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Nayel

Please help more.
dbrunton

Post one of the files here so we can see what format it is in.
BdLm

here is a example copy a File to a Blob Field:
-----   how to call the function ------
procedure TForm1.Button1Click(Sender: TObject);
var     BLobField        :  TBlobField;

begin


      BLobField := Table1.FieldByNAme('ModuleXML') as TBlobField;

      if  MyOpenDialog.Execute then

         begin
              SaveASCIIFileToTable(Table1,BLobField,MyOpenDialog.FileName);
         end;

end;
{**********************************************
 * in:
 *
 *  aTable       [paradox table]
 *  aXMLField    [fieldname]
 *  aFilename    [Name of a ASCII File to read]
 *
 *  Support:
 **********************************************}
procedure SaveASCIIFileToTable(aTable: TTable; aXMLField : TBlobField; aFilename : String);
var ss: TFileStream;
begin
 
  with aTable do
 
  begin
    Edit;
    try
       ss:=TFileStream.Create(aFilename, fmOpenRead	);
 
       ss.position := 0;
 
       aXMLField.LoadFromStream(ss);
    finally
       FreeAndNil(ss);
    end;
    Post;
  end;
 
end;

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
BdLm

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question