microsoft / microsoft/roosterjs

table cellpadding and cellspacing values get lost on exportContent

Open
#2,965 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
190
Avg merge
1d 8h
Merged PRs (30d)
16

Description

Describe the bug
When a table element has cellpadding and cellspacing attribute set, the cellpadding and cellspacing values get lost on exportContent.

I noticed in tableSpacingFormatHandler.ts, it is setting border-collapse as collapse if cellpadding is set for the table. At the same time, border-spacing is set as 0. However, when the cellpadding and cellspacing values are non-zero, the table will be rendered differently than expected.

To Reproduce
Steps to reproduce the behavior:

  1. Insert a table with cellpadding and cellspacing set as 20
  2. Trigger 'Export as HTML'
  3. Inspect the table exported
  4. The style of exported table will be"box-sizing: border-box; border-collapse: collapse; border-spacing: 0px;"

Expected behavior
cellpadding= 20 and cellspacing=20 should be converted to css styles accordingly

Device Information

  • Browser [All]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tableSpacingFormatHandler.ts and trace how exportContent handles tables with cellpadding and cellspacing. Reproduce the issue by exporting a table with both values set to 20, then inspect the generated HTML styles. Done means the exported table preserves the expected spacing and padding rather than forcing collapse and zero spacing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.