Skip to content
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

<blockquote> prevents header styles to be applied #21

Closed
pauldbentley opened this issue Jan 4, 2018 · 4 comments
Closed

<blockquote> prevents header styles to be applied #21

pauldbentley opened this issue Jan 4, 2018 · 4 comments

Comments

@pauldbentley
Copy link

pauldbentley commented Jan 4, 2018

After a blockquote, subsequent headers do not get styled

<blockquote>
  "The blockquote"
</blockquote>
<h1>This doesn't get the Heading style applied</h1>

The XML generated has the "IntenseQuote" style property applied on the heading paragraphs.

<w:body>
  <w:p>
    <w:pPr>
      <w:ind w:left="708" />
    </w:pPr>
    <w:r>
      <w:t xml:space="preserve">"The blockquote"</w:t>
    </w:r>
  </w:p>
  <w:p>
    <w:pPr>
      <w:pStyle w:val="IntenseQuote" />
    </w:pPr>
    <w:r>
      <w:t xml:space="preserve">This doesn't get the Heading style applied</w:t>
    </w:r>
  </w:p>
</w:body>
@peteamundson
Copy link

I believe this is caused by the code that selects the "IntenseQuote" style. If that style is not found (it appears to be renamed in the newest O365 version of the default Word template - and maybe in others), then there are two start tags added which causes the Header to break. One work around I have found is to rename the "Intense Quote" style in your Word document to "IntenseQuote" and then testing.

@onizet
Copy link
Owner

onizet commented Jan 5, 2018

I did some tests and it appears that now, Word lazily instantiate the style IntenseQuote and Heading X.
Thus on an empty document or on a document that are not yet referencing these styles, the style "heading 2" is well applied but refers to an non-existing style.

We first need to ensure the styles exists or push them ourself (like for the Hyperlink or Caption).

@peteamundson
Copy link

Even with the lazy loading of the style, the current code, when "IntenseQuote" does not exist, causes both the <w:ind w:left="708" /> and <w:pStyle w:val="IntenseQuote" /> to be added in the ProcessBlockQuote method (using two BeginTag calls). I'm not sure, but does that cause an issue because the EndTag for a blockquote is only called once in the ProcessClosingBlockQuote method?

@onizet
Copy link
Owner

onizet commented Jan 5, 2018

Oh yes, you are really right. I resolve the bug in another way but you are raising a real issue and I found that I can see the same bad behavior in the TableColumn. Which surely will fix another issue that was recently raised. Thank you, this is a very nice catch !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants