4. August 2015 11:50
FOR c := 1 TO Qty DO BEGIN
WordFields := WordDocument.Fields;
WordRange := WordFields.Item(c).Result;
ArrFieldnames[c] := DELCHR(WordRange.Text,'<>','<>');
ArrFields[c] := GetMailMergeFields(parMailMergeData."Data Field No.",ArrFieldnames[c],parMailMergeData."Root Data No.");
WordFields := WordDocument.Fields;
WordRange := WordFields.Item(c).Result;
WordRange.Text := ArrFields[c];
END;
GetMailMergeFields(parMailMergeNo : Integer;parFilename : Text;parRootNo : Code[20]) : Text[1024]
WordFieldManagement.RESET;
WordFieldManagement.SETCURRENTKEY("Data Field No.","Field Name");
WordFieldManagement.SETRANGE("Data Field No.",parMailMergeNo);
WordFieldManagement.SETRANGE("Field Name",parFilename);
IF WordFieldManagement.FINDFIRST THEN
EXIT(WordFieldAutomation.GetFieldValue(WordFieldManagement,parRootNo)); //hier wird über eine RecRef der Datensatz geholt
4. August 2015 12:38
4. August 2015 13:45
14. August 2015 15:40
LOCAL PROCEDURE GetItemPicture@1000000026(ItemNo@1000000005 : Code[20];VAR Picture@1000000006 : BigText);
VAR
Item@1000000007 : Record 27;
IStream@1000000004 : InStream;
MemoryStream@1000000003 : DotNet "'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.MemoryStream";
Bytes@1000000001 : DotNet "'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Array";
Convert@1000000000 : DotNet "'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Convert";
BEGIN
//**
// Function to convert a blobfield to a BigText base64 encoded string.
//*
Item.GET(ItemNo);
Item.CALCFIELDS(Picture);
IF NOT Item.Picture.HASVALUE THEN
EXIT;
Item.Picture.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream, IStream);
Bytes := MemoryStream.GetBuffer();
Picture.ADDTEXT(Convert.ToBase64String(Bytes));
END;