I am using advancedParser function:
private function advancedParser($type, $blockName, $textToParse, $options = []): void
{
switch ($type) {
case 'MarkdownText':
$markdownConverter = new GithubFlavoredMarkdownConverter();
$textToParse = $this->sanitizeReportString($textToParse);
$convertedText = $markdownConverter->convert($textToParse);
$tempTable = $this->word->addSection()->addTable();
$cell = $tempTable->addRow()->addCell();
//print_r(strval($convertedText)); die();
Html::addHtml($cell, nl2br(strval($convertedText)));
//Html::addHtml($cell, 'Hi');
$blockName = $this->sanitizeReportString($blockName);
$this->templateProcessor->setComplexBlock($blockName, $tempTable);
break;
----
-----
}
}
Calling advancedParser function as below with PHPOffice/PHPWord
$this->advancedParser('MarkdownText', 'vulnerability.description#' . ($index + 1), isset($vulnerability['description']) ?
$vulnerability['description'] : '');
I am getting this error while opening the word document:
'We found unreadable content in document'
How can I resolve the issue?
Even if I pass a simple text as 'Hi', still it shows the error.
It is mandatory to use MarkdownText case code.