docx
docx copied to clipboard
When using `patchDocument()` the custom numbering flow doesn't work.
When using patchDocument()
the custom numbering flow doesn't work. Or if it's possible where would we insert the INumberingOptions object?
When trying to open a docx that has been generated that has custom numbering it fails to open.
Expect that I can somewhere insert this and use
import { AlignmentType, convertInchesToTwip, INumberingOptions, LevelFormat } from 'docx';
export const CHECKLIST_NUMBERING = 'checklist-numbering';
const numbering: INumberingOptions = {
config: [
{
reference: CHECKLIST_NUMBERING,
levels: [
{
level: 0,
format: LevelFormat.BULLET,
text: '⬜',
alignment: AlignmentType.START,
# style: {},
},
{
level: 1,
format: LevelFormat.BULLET,
text: '✅',
alignment: AlignmentType.START,
# style: {},
},
],
},
],
};
export default numbering;
And then reference it like so: import { CHECKLIST_NUMBERING } from '../numbering';
const bulletStyle = styles.isChecklist
? { numbering: { level: isChecked ? 1 : 0, reference: CHECKLIST_NUMBERING } }
: { bullet: { level: 0 } };
Same thing, trying to figure out how to make numbering paragraphs patching document
This is required, not possible to do at the moment...
I am even unable to insert a simple bullet point using patchDocument. When the document is opened in Libre Office or Google Docs, the bullet point appears as plain text instead of as a bullet point.
const updatedDocBuffer = await patchDocument(docBuffer, {
patches: {
placeholder: {
type: PatchType.DOCUMENT,
children: [ new Paragraph({ text: "Bullet point content", bullet: { level: 0 }} ],
}
})
Are you experiencing similar issues? @lcampanis @yarosalvpp @martijn10kb