Frequently asked questions (FAQ).
You can ask your questions by e-mail.
Some of the questions and answers will appear on this page.
Q1: How to set particular printer for ARWordReport?
Q2: I have got unknown language characters in ARExcelReport
table. What can I do?
Q3: How can I specify display format in Word template
like this: Debet:0.00 ?
Q4: Is there a way to print the custom text into
a header or footer of MS Word report?
Q5: How to save report to file?
Q1: How to set particular
printer for ARWordReport?
A: Example:
ARWordReport.W.ActivePrinter:=
'HP LaserJet 1100';
Q2: I have got unknown
language characters in ARExcelReport table. What can I do?
A: It is a characters codepage problem.
Set ARExcelReport.TableCodePage
property to use prticular codepage for text in tables.
Since ARExcelReport v1.8
language codepage may be detected automatically.
Here is some of the possible values:
0 = no codepage.
maxword- automatic codepage detection (maxword=65535). System` default
codepage will be used.
874 Thai - ANSI, OEM.
932 Japanese - ANSI, OEM.
936 Chinese GBK (PRC, Singapore) - ANSI, OEM.
949 Korean Extended Wansung - ANSI, OEM.
950 Chinese BIG5 (Taiwan, Hong Kong) - ANSI, OEM.
1250 Central / Eastern Europe - ANSI.
1251 Cyrillic - ANSI.
1252 Latin I - ANSI (main).
1253 Greek - ANSI.
1254 Turkish - ANSI.
1255 Hebrew - ANSI.
1256 Arabic - ANSI.
1257 Baltic - ANSI.
1258 Viet Nam - ANSI, OEM.
Example:
ARExcelReport.TableCodePage:=
1251; {Cyrillic}
Q3: How can I specify
display format in Word template (0.00 for example)?
A: It is possible to implement any custom formatting, using
ARWordReport.OnTag event
By this way you can also implement your own custom functions.
To format values, place this tag in template:
<#<#ds.charge>:0.00>
and implement ARWordReport.OnTag
event handler:
procedure TForm1.ARWordReport1Tag(Sender:
TObject; var TagValue: String);
var
i: integer;
s, sf: string;
begin
i:= AnsiPos(':',TagValue);
if i>0 then begin
s:= Copy(TagValue,1,i-1);
sf:= Copy(TagValue,i+1,maxint);
TagValue:= FormatFloat(sf,StrToFloat(s));
end;
end; |
during template processing
<#<#ds.charge>:0.00> tag will be replaced with
<#123.1:0.00>
(where "123.1" is "charge" field value) and then, after OnTag
event handler calling, it will be replaced with
123.10
By this way you can also implement your own custom functions, like
<#MyFunction(<#ds.charge>)>
Q4: Is there a way to
print the custom text into a header/footer of MS Word report?
A: You have to set ARWordReport.NeedHeaderFooterProc
to 'True' for header/footer tags processing.
Q5: How to save Word report to file?
A: You should call ARWordReport.Parse
and then ARWordReport.SaveDoc method. Here
is the code snippet:
...
WordReport1.CustTagValues.Values['id']:=
ADOTable1id.AsString;
WordReport1.CustTagValues.Values['name']:=
ADOTable1name.AsString;
WordReport1.Parse; //Open+Process template
//WordReport1.ShowWord; //uncomment if you
need to show it on screen
WordReport1.SaveDoc('c:\new.doc');
WordReport1.CloseWord; //closes Word if
it is invisible.;
...
|
Comment: Every time you generate document, the template (.doc
file) keep untouched. During either ARWordReport.Open||Parse||Preview
you are dealing with new unsaved document which is initially equal to
template. And this new document processed while other users can generate
reports based on the same template file. You can save document
to file (WordReport1.SaveDoc) only after
calling ARWordReport` Open, Parse or Preview methods.