Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set table cell margins #116

Open
kristofferjalen opened this issue Feb 28, 2023 · 3 comments
Open

Cannot set table cell margins #116

kristofferjalen opened this issue Feb 28, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@kristofferjalen
Copy link

I understand table cell margins should be set like this:

var tableCellMarginDefault = new TableCellMarginDefault(
   new TopMargin { Width = "21", Type = TableWidthUnitValues.Pct },
   new StartMargin { Width = "21", Type = TableWidthUnitValues.Pct },
   new BottomMargin { Width = "21", Type = TableWidthUnitValues.Pct },
   new EndMargin { Width = "21", Type = TableWidthUnitValues.Pct });

var tableProperties = new TableProperties(tableCellMarginDefault);

I cannot find a way to assign the TableProperties instance to a table though.

@PrzemyslawKlys
Copy link
Member

I don't think we expose margins directly yet. We only support choosing one of the built-in styles which already have the required margins set. This needs to be added/exposed.

@PrzemyslawKlys PrzemyslawKlys added the enhancement New feature or request label Mar 1, 2023
@PrzemyslawKlys
Copy link
Member

Additional questions for it:

  • you're after setting totally custom style or modifying existing styles?
  • what would be expectation when you have table with style GridTable6ColorfulAccent1 that you "modify" on the table - would you want it to apply to all tables using same style or the style should now be cloned and become new style?

The more think about it, the more complicated it becomes to implement.

@PrzemyslawKlys
Copy link
Member

Some documentation around this:

It seems tableCellMarginDefault is settable on the style itself. However one can use TableCellMargin to apply margins directly to specific table.

<w:tblPr>
  <w:tblCellMar>
    <w:top w:w="144" w:type="dxa"/>
    <w:left w:w="144" w:type="dxa"/>
    <w:bottom w:w="144" w:type="dxa"/>
    <w:right w:w="144" w:type="dxa"/>
  </w:tblCellMar>
  …
</w:tblPr>

We need to support both, but in different ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants