RE: "Email Message".Create - How to read body from a Word Template
Thanks all for your help. I'm now reading my Word template doc and displaying the content in the Email Editor page. However, I wanted to simulate the user editing the template document in BC. So, I went into Custom Report Layouts and performed the following steps:-
1. New -> New -> Edit - Insert Built-in Layout for a Report.
2. Specified my template ID, switched on 'Insert Word Layout' and clicked [OK].
3. Selected my Report ID -> Layout -> Export Layout
4. Opened the exported document in Word, changed some text and saved it.
5. Back in BC, -> Layout -> Import Layout -> Chose my edited document and clicked [Open]
6. Layout -> Update Layout -> System reports: The Word layout has been updated to use the current report design.
7. Process -> Run Report -> changes are displayed.
However when I run my extension the original wording is displayed. Why? Here's my procedure:-
local procedure GetBodyTextFromTemplate(var recLogSheet: Record LogSheets; var txtBody: Text): Boolean
var
OutS: OutStream;
InS: InStream;
TempBlob: Codeunit "Temp Blob";
RecRef: RecordRef;
bReturn: Boolean;
begin
txtBody := '';
TempBlob.CreateOutStream(OutS);
RecRef.Get(recLogSheet.RecordId);
bReturn := Report.SaveAs(50051, '', ReportFormat::Html, OutS, RecRef);
if bReturn then begin
TempBlob.CreateInStream(InS);
InS.ReadText(txtBody);
end;
Exit(bReturn);
end;