create a paragraph style with shadings #2314
-
I want to create a paragraph style with shadings. The sample code is next. import * as fs from "fs";
import { Document, Packer, Paragraph, ShadingType } from "docx";
const doc = new Document({
styles: {
paragraphStyles: [
{
id: "code",
name: "code",
run: {
color:"ff0000",
shading: {
type: ShadingType.PERCENT_15,
fill: "eeeeee",
color: "eeeeee"
},
},
},
],
},
sections: [
{
children: [
new Paragraph({
text: "Hello World for not entire paragraph",
style: "code",
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
}); And the result is next. The shading property is set to the font area not to the paragraph area. #531 is similar, but not for style. |
Beta Was this translation helpful? Give feedback.
Answered by
dolanmiu
Dec 31, 2023
Replies: 1 comment
-
This is now done: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dolanmiu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is now done:
#669