-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sub/superscript HTML is rendered with line breaks #2476
Comments
I have a different environment than yours, but I made it work with C8H10N4O2 ";instead of $textWithTags = "C8H10N4O2"; I suppose it is because in the readParagraph function, there is the following part And then when writing it, in HTML writer for example, it does "if ($this->withoutP) { ' . PHP_EOL; }" Note that adding a paragraph around your $textWithTags add also a text run |
First, this seems to be a problem with all formatting tags (e.g. $textRun = $section->addTextRun();
Html::addHtml($textRun, $textWithTags); Likewise for a table cell: $textRun = $cell->addTextRun();
Html::addHtml($textRun, $textWithTags); |
Perhaps because for OOXML, " A section is a grouping of paragraphs that have a specific set of properties used to define the pages on which the text will appear." |
Describe the Bug
When attempting to add text with
<sup>...</sup>
or<sub>...</sub>
tags usingHtml::addHtml
and placing it into a Section or Table Cell, the resulting text has unwanted line breaks. When placing it in aTextRun
, the text isn't rendered at all.Steps to Reproduce
Please provide a code sample that reproduces the issue.
Our target behavior is actually to render the text with
sub/sup
tags inside a table that is used with the template processor:In the above example, the text inside the table cell has line breaks as well.
Working example
We know this behaviour is possible as this does work in the
TemplateProcessor
with a TextRun:Now the sub/sup tags are rendered correctly on a single line.
Expected Behavior
I would expect the text to be rendered without line breaks whether in a table cell, a textrun, or any other element; with or without the TemplateProcessor.
Current Behavior
Text with
sub
orsup
HTML tags is rendered with line breaks.Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: