Fix four bugs causing PowerPoint repair dialog & missing bullets (#1432, #1440, #1441, #1442)#1457
Open
rupivbluegreen wants to merge 1 commit into
Open
Conversation
…t#1440, gitbrent#1441, gitbrent#1442) * gitbrent#1432 - bullet:{type:'bullet'} now produces a bullet character Merged the outer 'if (bullet.type)' and inner 'if type === number' conditions so non-number types fall through to the default bullet rendering branch instead of being silently dropped. * gitbrent#1440 - guard table cell margin against non-number/non-array values Falls back to DEF_CELL_MARGIN_IN and maps any non-finite entries to 0, preventing marL/marR/marT/marB='NaN' attributes that trigger the PowerPoint repair dialog. * gitbrent#1441 - shapes without text now emit a minimal valid <p:txBody> genXmlTextBody() previously returned an empty string for non-tablecell objects with no text, leaving <p:sp> elements without their required <p:txBody> child (OOXML schema violation, triggers repair dialog). * gitbrent#1442 - solid color slide backgrounds include <a:effectLst/> Brings the solid color background branch in line with the image background branch, avoiding the PowerPoint repair dialog.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Fixes four small bugs in
src/gen-xml.ts, all of which are reported with reproductions and root-cause analysis in the linked issues. Three produce OOXML schema violations that trigger the PowerPoint repair dialog; one silently drops a bullet style.Change Type
Related Issues
bullet: {type: "bullet"}results in no bullet #1432 —bullet: { type: "bullet" }results in no bulletNaNXML attributes for invalid input<p:sp>missing<p:txBody><a:effectLst/>Motivation and Context
Three of these (#1440, #1441, #1442) produce OOXML schema violations that cause PowerPoint to show the "PowerPoint found a problem with content" repair dialog when opening a generated file. The fourth (#1432) makes
bullet: { type: 'bullet' }— a documented and TypeScript-typed value (type?: 'bullet' | 'number', default'bullet') — silently produce no bullet. The fixes are minimal and isolated; all four root causes were already debugged by the original reporters.Change Description
gen-xml.ts:93— Issue #1442Solid color background now includes
<a:effectLst/>, matching the image-background branch one line above.gen-xml.ts:320— Issue #1440Adds two defensive guards after the existing number-to-array conversion:
cellMarginis still not an array (i.e. user passed an object or string), fall back toDEF_CELL_MARGIN_IN0soinch2Emu(undefined)can no longer yieldmarL=\"NaN\"etc.gen-xml.ts:890— Issue #1432Merges the outer
if (bullet.type)and innerif (type === 'number')checks into a single condition so non-number types fall through to thecharacterCode/code/ default branches and produce a normal bullet character.gen-xml.ts:1158— Issue #1441genXmlTextBody()no longer returns an empty string when a non-tablecell object has no text; it returns a minimal valid<p:txBody>(<a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang=\"...\"/></a:p>) so the enclosing<p:sp>satisfies the OOXML schema. Thelangdefaults toopts.lang || 'en-US', consistent with other endParaRPr emissions in this file.Verification
Built locally with
npm run buildand ran a small Node script that exercises each scenario and inspects the resulting XML in the generated.pptx:```
PASS #1442 solid bg includes <a:effectLst/>
PASS #1441 empty-text shape has <p:txBody>
PASS #1440 bogus table margin produces no NaN attributes
PASS #1432 bullet:{type:"bullet"} renders <a:buChar>
```
Confirmed that the same script fails on `master` (without the fix), and `npx eslint src/gen-xml.ts src/gen-objects.ts` passes clean.
Checklist
src/*.tsmodified — nodistorsrc/bldchanges