The Wayback Machine - https://web.archive.org/web/20200920201146/https://github.com/dolanmiu/docx/issues/536
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

Adding borders to paragraph styles (how I did it) #536

Open
billreynolds007 opened this issue May 3, 2020 · 0 comments
Open

Adding borders to paragraph styles (how I did it) #536

billreynolds007 opened this issue May 3, 2020 · 0 comments

Comments

@billreynolds007
Copy link

@billreynolds007 billreynolds007 commented May 3, 2020

There was a previous issue
#462
described adding borders to individal paragraphs via the example at
https://github.com/dolanmiu/docx/blob/master/demo/26-paragraph-borders.ts

I wanted to add borders to paragraph styles and did not see support for this.
I made the following changes,

class ParagraphStyle extends style_1.Style {
    constructor(options) {
        super({ type: "paragraph", styleId: options.id }, options.name);
       // <--- START CHANGE
        if (options.paragraph && options.paragraph.border)
        	{
        	this.paragraphProperties = new paragraph_1.ParagraphProperties(options.paragraph);
        	}
        else // END CHANGE --->
        	this.paragraphProperties = new paragraph_1.ParagraphProperties({});
	...

The regular border options are passed in as shown below
paragraphStyleOptions.paragraph.border = the border options...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.