Just to clarify this is a Google Active Script.
Read Google Doc File ( this is a template with place holders and formatting ( bod, tabs, underline etc ) Place holders are {placeholderName}
I use Body.replaceText('{placeholderName}', placeholderName)
this works fine. The data that is inserted is contained within a Google Spreadsheet (that works fine too) I am only trying to maintain formatting in the template file that is modified and then appended to the final file.
var SerialLetterID = DriveApp.getFileById('google_doc_id').makeCopy('filename').getId();
var fBody = DocumentApp.openById(SerialLetterID);
// an independent copy of the template ( with formatting )
var Template = fBody.getBody().copy();
After the data replaces the placeholders
// insert a pageBreak
fBody.getBody().appendPageBreak();
/*
this is where I'm getting the issues.. everything works but the getText()
removes all formatting. I looked for a getCopy() or something of the like
but nothing like that seems to exist. So, in OOP google style how would I
copy the page, maintain formatting in the same manner as getText() works?
*/
// add template with placeholders
fBody.getBody().appendParagraph(Template.getText());
I hope that I explained what I'm trying to do.