- Offizieller Beitrag
ZitatIm using this in my template so every page is numbered but I need the number spelled out instead of just the number. (What I need this to do is insert 'Page Two' instead of 'Page 2'.)
Yes, this is possible. You insert the page number fields as you did before with WPRichText1.InputTextField(wpoPageNumber) - but you add an event to OnTextFieldGetText. Here you can use code like
Code
function TWPWordForm.WPRichText1TextFieldGetText(Sender, Field: TObject; var done: Boolean): string;
var
n: integer;
begin
if (Field as TWPObjectField).FieldName = 'PAGE' then
begin
if wpRichText1.memo.fix_Active then
n := wpRichText1.Memo.Fix_CurrentPage
+ wpRichText1.Memo.PageNumberOffSet
else
n := wpRichText1.memo.FieldPageNumber
+ wpRichText1.Memo.PageNumberOffSet;
case n+1 of
1 : Result := 'one';
2 : Result := 'two';
3 : Result := 'three';
4 : Result := 'four';
5 : Result := 'five';
6 : Result := 'six';
7 : Result := 'seven';
8 : Result := 'eight';
9 : Result := 'nine';
10 : Result := 'ten';
else Result := IntToStr(n);
end;
Done := true;
end;
end;
Alles anzeigen
Julian Ziersch