Okay. When I use \n with instead of break it works with the replaceVariableByText() method. For whne there is a bold tag in the sentence we use below code
$docx = new CreateDocx();
$wf = new WordFragment($docx);
$text[] = array(
'text' => $partialInputExploded[$i],
'bold' => true,
'fontSize' => 5.5,
'font' => 'Arial',
);
$wf->addText($text, array('font' => 'Arial', 'fontSize' => 7)); and then use replaceVariableByWordFragment(array($placeHolderName => $fomattedWordFragment), array('type' => 'inline')); So for this we \n add the sentence to new line but \n remains same in the generated output