Solved

Print text to printer as HTML

Posted on 2001-08-04
6
253 Views
Last Modified: 2010-04-04
i got a lil problem, i want to Print memo1.lines to the printer but not as ?lain text but as HTML

the memo1.lines is written as a HTML webpage so i dont think it shouldnt be hard so hard...
0
Comment
Question by:TeChNiCh
6 Comments
 
LVL 6

Expert Comment

by:edey
Comment Utility
Then you'd have to render it. Prob the easiest way would be to load it into a TWebBrowser & let IE print it for you, something like this:

procedure TForm1.Button1Click(Sender: TObject);
var
   vaIn, vaOut: OleVariant;
   ms : TMemoryStream;
begin
     ms := TMemoryStream.create;
     memo1.Lines.saveToStream(ms);
     WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(AStream);
     ms.free;
     while webBrowser1.busy do
           application.processMessages;
     WebBrowser.ControlInterface.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);
end;

GL
Mike
0
 
LVL 21

Expert Comment

by:gemarti
Comment Utility
I don't think you can print from a Memo component.

have you tried putting the information into a RichEdit component and printing?

Richedit1.Print(string);
0
 

Author Comment

by:TeChNiCh
Comment Utility
WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(AStream);

get a lil error there
IPersistStreamInit undeclared identifier
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Accepted Solution

by:
edey earned 140 total points
Comment Utility
I belive that it's declared in activeX.pas so you'll need to add activeX to your uses clause.

GL
Mike
0
 
LVL 5

Expert Comment

by:Netminder
Comment Utility
0
 

Expert Comment

by:SpideyMod
Comment Utility
Administrative Action - Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now