|
Your import font declaration can't work; importing a font declaration in a document from the same document doesn't make sens. A font declaration should be imported either from another document or from an application-provided XML string (hardcoded in my example below). In addition, a text style (with given font type and size, say "Comic Sans MS" and "11pt") may apply to a paragraph, not to a frame. So you should append the text to the frame element as a paragraph; this paragraph must be created with the "ComicMS11" style.
For example you could try to replace all that:
$doc->importFontDeclaration($doc, "Comic Sans MS");
$text = $doc->setText($element,"TEST INSERT TEXT");
$doc-> textStyle($element,"ComicMS11");
by that:
$doc->importFontDeclaration
(
'<style:font-face ' .
'style:name="Comic Sans MS" ' .
'svg:font-family="Comic Sans MS" />'
);
$doc->appendParagraph(
attachment => $element,
text => "TEST INSERT TEXT",
style => "ComicMS11"
);
|