Skip to content

Commit 0d5c402

Browse files
committed
additional cleanup
1 parent d0ec22b commit 0d5c402

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

src/helper/xml-elements.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,18 @@ export default class XmlElements {
5555
return txBody;
5656
}
5757

58-
// Method to create bodyPr element
5958
createBodyProperties(txBody: XmlElement): XmlElement {
6059
const bodyPr = this.document.createElement('a:bodyPr');
6160
txBody.appendChild(bodyPr);
6261
return bodyPr;
6362
}
6463

65-
// Method to create lstStyle element
66-
createListStyle(txBody: XmlElement): XmlElement {
67-
const lstStyle = this.document.createElement('a:lstStyle');
68-
69-
// Loop through levels (assuming 3 levels here)
70-
for (let level = 1; level <= 3; level++) {
71-
const lvlpPr = this.document.createElement(`a:lvl${level}pPr`);
72-
73-
// Set bullet font
74-
const buFont = this.document.createElement('a:buFont');
75-
buFont.setAttribute('typeface', 'Arial');
76-
lvlpPr.appendChild(buFont);
77-
78-
// Set bullet character (you can use different characters for each level)
79-
const buChar = this.document.createElement('a:buChar');
80-
buChar.setAttribute('char', '•');
81-
lvlpPr.appendChild(buChar);
82-
83-
lstStyle.appendChild(lvlpPr);
84-
}
85-
86-
txBody.appendChild(lstStyle);
87-
return lstStyle;
88-
}
89-
90-
// Method to process the bullet list
9164
addBulletList(list: []): void {
9265
const txBody = this.createTextBody();
9366
this.createBodyProperties(txBody);
94-
this.createListStyle(txBody);
9567
this.processList(txBody, list, 0);
9668
}
9769

98-
// Recursive method to create paragraphs and text runs for each list item
9970
processList(txBody: XmlElement, items: [], level: number): void {
10071
items.forEach((item) => {
10172
if (Array.isArray(item)) {
@@ -109,7 +80,6 @@ export default class XmlElements {
10980
});
11081
}
11182

112-
// Method to create a paragraph element
11383
createParagraph(level: number): XmlElement {
11484
const p = this.document.createElement('a:p');
11585
const pPr = this.document.createElement('a:pPr');
@@ -120,15 +90,13 @@ export default class XmlElements {
12090
return p;
12191
}
12292

123-
// Method to create a text run element
12493
createTextRun(text: string): XmlElement {
12594
const r = this.document.createElement('a:r');
12695
const rPr = this.document.createElement('a:rPr');
12796
r.appendChild(rPr);
12897

12998
const t = this.document.createElement('a:t');
130-
const textNode = this.document.createTextNode(text);
131-
t.appendChild(textNode);
99+
t.textContent = String(text);
132100

133101
r.appendChild(t);
134102
return r;

0 commit comments

Comments
 (0)