I'm using WpTools 7.33 in Berlin. After upgrading from V6 (and Delphi XE) my code for mail merging photos no longer seems to work.
I'm using the following, basically I'm just iterating over the photos, and then using the TWPOImage.LoadFromFile method to replace a placeholder image, which is the bit that no longer seems to work. Any suggestions how I might change the code to be compatible with V7?
Code
procedure TfDataWordProcessor.MergePhotos;
var
i: Integer;
begin
inherited;
for i := 0 to WP.TextObjects.Count - 1 do
begin
if WP.TextObjects.List[i] is TWPOImage then
ProcessPhoto(WP.TextObjects.List[i] as TWPOImage);
end;
end;
Procedure TfDataWordProcessor.ProcessPhoto(wpoi : TWPOImage);
var
FullFileName : string;
begin
FullFileName := GetDataFromTableField(wpoi.FileName);
if FullFileName = FIELD_NOT_FOUND then
Exit; //is a standard image
if (FullFileName <> '') and FileExists(FullFileName) then
begin
wpoi.LoadFromFile(FullFileName)
end
else
wpoi.graphic := nil;
end;
Alles anzeigen