Hi guys,

I got a another question. i want to know how to go about saving a form1 to disk instead of printing it, so that i can email it to someone in a format that can be opened and read by the recepient. like for instance a home loan application form. i can print it yes but i am stumped about coding my app to save the file to disk.
can someone please help

Thanx
Vdub.za

Recommended Answers

All 3 Replies

Hi
This code is For Saving your Form to Disk. For Example You can use this code as OnClik routine of your Form.

procedure TForm1.Button1Click(Sender: TObject);
Var
    Bitmap:TBitMap;
    R:TRect;
begin
    BitMap:=TBitMap.Create;
    Try
        BitMap.Width:=Form1.ClientWidth;
        BitMap.Height:=Form1.ClientHeight;
        R:=Rect(0,0,Form1.ClientWidth,Form1.ClientHeight);
        BitMap.Canvas.CopyRect(R,Form1.Canvas,R);
        Bitmap.SaveToFile('Form1.BMP');
    Finally
        Bitmap.Free;
    End;
end;

hi

when i originally posted this question i was told it was to safe a form1 to disk now i am told no, the question is actually how do i save a rave report - to disk instead of printing it. are there any differences or not? i tried the code that was supplied but i get an error saying "undeclared identifier 'clientwidth' " and i take it will say the same for height and all other measurements. sorry to keep on bugging you guys about it.

Thank you
Vdub.za

Have you checked the rave help for a savetofile or savetocsv?
Do you need the raw data or the report as an image?
Do you need it to be automated from code, or just a way the user can do it for a given on-screen report?

Anyway, try using a PDF printer, for instance, PDFCreator can save in PDF, but also in JPEG if neccesary, so you can paste it into an email.

This printer can be commanded for your app via registry or via com object, so you can autosave to a folder with the names you need and in the format you need (not exactly easy, but possible and works ok).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.