Skip to content

Conversation

@arisktfx
Copy link
Contributor

@arisktfx arisktfx commented Mar 20, 2025

Problem and/or solution

In pptx, when a paragraph contains one or more empty (only spaces) a:t tags, it prepents the spaces to the next text element, without creating a new openstring. This could not be handled correctly when compiling the file, which then generates a corrupted pptx file when opened with MS PowerPoint. Enclosing the empty a:t tags with a tx tag as we do with other string will retain the correct format of the document. Since this is a braking chacnge, the common parse_paragraph, compile_paragraph functions where moved to the PptxHandler class so that only the pptx file format is affected (not docx).

How to test

Parse a slide that contains the following paragraph

<a:p>
  <a:pPr algn="l" indent="0" lvl="0" marL="0" rtl="0"
  >
    <a:spcBef>
      <a:spcPts val="0" />
    </a:spcBef>
    <a:spcAft>
      <a:spcPts val="0" />
    </a:spcAft>
    <a:buNone />
  </a:pPr>
  <a:r>
    <a:rPr lang="en" sz="2400"
    >
      <a:solidFill>
        <a:srgbClr val="FFFFFF" />
      </a:solidFill>
      <a:latin typeface="Roboto Mono" />
      <a:ea typeface="Roboto Mono" />
      <a:cs
        typeface="Roboto Mono" />
      <a:sym typeface="Roboto Mono" />
    </a:rPr>
    <a:t>First string</a:t>
  </a:r>
  <a:r>
    <a:rPr lang="en" sz="4000"
    >
      <a:solidFill>
        <a:srgbClr val="FFFFFF" />
      </a:solidFill>
      <a:latin typeface="Roboto Mono" />
      <a:ea typeface="Roboto Mono" />
      <a:cs
        typeface="Roboto Mono" />
      <a:sym typeface="Roboto Mono" />
    </a:rPr>
    <a:t> </a:t>
  </a:r>
  <a:br>
    <a:rPr lang="en" sz="4000"
    >
      <a:solidFill>
        <a:srgbClr val="FFFFFF" />
      </a:solidFill>
      <a:latin typeface="Roboto Mono" />
      <a:ea typeface="Roboto Mono" />
      <a:cs
        typeface="Roboto Mono" />
      <a:sym typeface="Roboto Mono" />
    </a:rPr>
  </a:br>
  <a:r>
    <a:rPr b="1" lang="en" sz="4800"
    >
      <a:solidFill>
        <a:srgbClr val="00FFFF" />
      </a:solidFill>
      <a:latin typeface="Roboto" />
      <a:ea typeface="Roboto" />
      <a:cs
        typeface="Roboto" />
      <a:sym typeface="Roboto" />
    </a:rPr>
    <a:t>last string</a:t>
  </a:r>
  <a:endParaRPr b="1" sz="4800"
  >
    <a:solidFill>
      <a:srgbClr val="00FFFF" />
    </a:solidFill>
    <a:latin typeface="Roboto" />
    <a:ea typeface="Roboto" />
    <a:cs
      typeface="Roboto" />
    <a:sym typeface="Roboto" />
  </a:endParaRPr>
</a:p>

Reviewer checklist

Code:

  • Change is covered by unit-tests
  • Code is well documented, well styled and is following best practices
  • Performance issues have been taken under consideration
  • Errors and other edge-cases are handled properly

PR:

  • Problem and/or solution are well-explained
  • Commits have been squashed so that each one has a clear purpose
  • Commits have a proper commit message according to TEM

@arisktfx arisktfx force-pushed the fix_space_with_format branch 9 times, most recently from 41dd2ea to 39dc6c5 Compare March 26, 2025 09:27
Copy link
Contributor

@foteinigk foteinigk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix works great!! 🚀
let's decide only if we would need a new version parser for this fix

@arisktfx arisktfx force-pushed the fix_space_with_format branch 3 times, most recently from f8cb444 to 437e932 Compare March 31, 2025 07:21
@arisktfx arisktfx force-pushed the fix_space_with_format branch from 437e932 to 9fabfa0 Compare March 31, 2025 07:24
Copy link
Contributor

@deathbird deathbird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix @arisktfx 💪 !!

@arisktfx arisktfx merged commit 29549e6 into devel Apr 8, 2025
4 checks passed
@arisktfx arisktfx deleted the fix_space_with_format branch April 8, 2025 07:32
@txsentinel txsentinel mentioned this pull request Apr 8, 2025
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

Successfully merging this pull request may close these issues.

4 participants