home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_03_03
/
3n03051a
< prev
next >
Wrap
Text File
|
1991-10-06
|
3KB
|
85 lines
program Try_WP_Lib;
(* -------------------------------
Listing 2: Demo program
Program Try_WP_Lib illustrates the use of WP_Lib.
It uses WP_Lib to create a sample WordPerfect
document.
by David Andrew Price
Version 1.0
------------------------------- *)
uses Dos, Crt, WP_Lib;
var OutFileName : String;
OutFile : Text;
Attrib : WP_TextAttribute;
Para, Sentence : Integer;
begin (* main *)
Writeln('What is the file you want to write to?');
Readln(OutFileName);
Assign(OutFile, OutFileName);
Rewrite(OutFile);
(* Write the header for WP 5.0 documents *)
Write(OutFile, WP_Header);
(* Put page numbers at the bottom center of each
page *)
Write(OutFile,
WP_Set_PageNumPos(WP_BottomCenterNum));
(* Write ten paragraphs and end each with two hard
returns. The paragraphs alternate between
justified right margins and ragged right
margins. *)
for Para := 1 to 10 do
begin
if Odd(Para) then
Write(OutFile, WP_RightJustOn)
else
Write(OutFile, WP_RightJustOff);
for Sentence := 1 to 5 do
Write(OutFile,
'This is a sample sentence. ');
Write(OutFile, WP_HardReturn, WP_HardReturn)
end;
(* An example of a hard page break *)
Write(OutFile, 'A hard page break occurs below:',
WP_HardPage);
(* An example of underlined text *)
Write(OutFile, 'This is an example of ',
WP_Attrib_On(WP_Underline),
'underlined',
WP_Attrib_Off(WP_Underline),
' text.', WP_HardReturn);
(* An example of a hard space *)
Write(OutFile, 'There is a hard',WP_HardSpace,
'space between ');
Write(OutFile, 'the fourth and fifth words of ',
'this sentence.');
Write(OutFile, WP_HardReturn);
(* Print an example of all sixteen print
attributes *)
Write(OutFile, WP_HardReturn, WP_HardReturn);
Write(OutFile, 'The following shows all sixteen ');
Write(OutFile, 'WordPerfect print attributes:');
Write(OutFile, WP_HardReturn, WP_HardReturn);
for Attrib := WP_ExtraLarge to WP_SmallCaps do
Write(OutFile, WP_Attrib_On(Attrib),
'ABCDE fghij',
WP_Attrib_Off(Attrib),
WP_HardReturn);
Close(OutFile)
end.