Skip to content

Add MiniWordTableBorder for dynamic table border control#115

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/provide-word-border-standard
Draft

Add MiniWordTableBorder for dynamic table border control#115
Copilot wants to merge 2 commits intomainfrom
copilot/provide-word-border-standard

Conversation

Copy link

Copilot AI commented Mar 7, 2026

No way existed to programmatically set table borders via the MiniWord template system. Users had to pre-style tables in the template and had no runtime control over border style, color, or width.

Changes

  • MiniWordTableBorder / MiniWordBorder classes (MiniWordTableBorder.cs) — new public API. MiniWordBorder represents a single edge (style, color, size, space); MiniWordTableBorder holds six optional edges (top, bottom, left, right, insideH, insideV) plus a Create(color, size) factory for uniform all-edge borders.
  • Tag processing (MiniWord.Implment.cs) — ReplaceText detects a MiniWordTableBorder value, walks up the XML tree to the parent <Table>, upserts a <w:tblBorders> element into <w:tblPr>, and clears the placeholder text. Empty <w:tblBorders> is never written (skipped when no edges are set).
  • Test framework (MiniWordTests.csproj) — target updated from net6.0net8.0.
  • TestsTestTableBorder_AllBorders and TestTableBorder_CustomEdges cover uniform and per-edge scenarios.

Usage

Place {{TableBorder}} in any cell of the target table:

// Uniform single-line black border on all six edges
value["TableBorder"] = MiniWordTableBorder.Create("#000000", 6);

// Per-edge control
value["TableBorder"] = new MiniWordTableBorder
{
    TopBorder    = new MiniWordBorder { Style = BorderValues.Double, Color = "FF0000", Size = 8 },
    BottomBorder = new MiniWordBorder { Style = BorderValues.Double, Color = "FF0000", Size = 8 },
    LeftBorder   = new MiniWordBorder { Style = BorderValues.Single, Color = "0000FF", Size = 4 },
    RightBorder  = new MiniWordBorder { Style = BorderValues.Single, Color = "0000FF", Size = 4 },
};

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: shps951023 <12729184+shps951023@users.noreply.github.com>
Copilot AI changed the title [WIP] Add word border standard documentation Add MiniWordTableBorder for dynamic table border control Mar 7, 2026
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.

2 participants