Skip to content

Table containers missing top margin/padding when preceded by paragraphs #108

@JSv4

Description

@JSv4

Description

When a DOCX document contains a table preceded by a paragraph, the rendered HTML output has no spacing between the paragraph and the table. The paragraph text visually overlaps or bleeds into the table's top border.

Observed Behavior

The <div> container wrapping the <table> element in the docxodus HTML output has:

  • padding-top: 0
  • border-top-style: none
  • margin-top: 0 (effectively)

This causes the preceding paragraph to sit directly on top of the table border with no visual separation.

Expected Behavior

There should be appropriate margin-top or padding-top on the table container <div> (or margin-bottom on the preceding paragraph's container) to provide visual separation, matching how Word/LibreOffice render the same document.

Reproduction

Any DOCX with a paragraph immediately followed by a table. Example: the CUAD v1 Datasheet document contains a table of "Type of Contracts" / "# of Docs" that demonstrates this.

Inspector Details

div.docx-000005 {
    border-top-style: none;
    padding-top: 0;
    border-right-style: none;
    padding-right: 0;
    border-bottom-style: none;
    padding-bottom: 0;
    border-left-style: none;
    padding-left: 0;
    margin-left: 0.01in;
}

Screenshot

The paragraph "The dataset includes commercial contracts selected from 25 different types..." overlaps the table border below it.

Environment

  • docxodus-service: 1.1.0-docxodus5.4.2
  • docxodus (npm): 5.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions