Docx: Unable to customize table borders

Created on 4 Feb 2019  路  6Comments  路  Source: dolanmiu/docx

Hey, I'm trying to customize table borders.

I'm trying to do it for client-side with the demo #20 (changed add to create Paragraph because it didn't work too for some reason) and it still doesn't work.

    const table = doc.createTable(4, 4);
    table
      .getCell(2, 2)
      .createParagraph('test')
      .Borders.addTopBorder(BorderStyle.DASH_DOT_STROKED, 3, "red")
      .addBottomBorder(BorderStyle.DOUBLE, 3, "blue")
      .addStartBorder(BorderStyle.DOT_DOT_DASH, 3, "green")
      .addEndBorder(BorderStyle.DOT_DOT_DASH, 3, "#ff8000");

It fails on the .Borders part.

Could anyone help me out with that issue?

bug

All 6 comments

Try this:

https://github.com/dolanmiu/docx/blob/ab07f2ecbec1d6fae338cd77f9c6cc40c37b7866/demo/demo20.ts

Demo was updated due to a new API, but I don't think the latest version with the said API is released yet

Hey, first of all thanks for the help. Big fan of the repo and would be happy to contribute to it in the future.

I did try to use that specific demo and it didn't work (as mentioned in the original comment: changed addParagraph to createParagraph because it didn't work)

Other than that, all code is identical (worth mentioning: is in the browser)

Ok I will take a look into this.

Seems like there are a lot of issues raised regarding tables, so I will go through a big development session on the Tables feature once I get time

Sure, thanks.
Let me know if any help is especially needed anywhere, in any way, related to that problem or not. 馃槃

Have a nice weekend!

Any update on this or any work around to remove borders for specific cells or rows?

I tried this:

  portfolioTable
      .getCell(0, 0)
      .createParagraph('Hello')
      .Properties.Borders.addTopBorder(BorderStyle.NONE);

and get the following error:

Cannot read property 'Borders' of undefined

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uldcra picture uldcra  路  3Comments

madarche picture madarche  路  5Comments

zahrafali picture zahrafali  路  5Comments

zahrafali picture zahrafali  路  5Comments

davideickhoff picture davideickhoff  路  6Comments