Strike and underline don't work in Word when used together
See original GitHub issueHi there, I need an ability to use both strike and underline at the same time. It works great for Google docs but doesn’t work for Word web version. Also text color and font size doesn’t work. Here is code, I took it from example and changed a bit:
const fs = require("fs");
const docx = require("docx");
const {ExternalHyperlink} = require("docx");
const { Document, Packer, Paragraph, TextRun } = docx;
// Documents contain sections, you can have multiple sections per document, go here to learn more about sections
// This simple example will only contain one section
const doc = new Document({
sections: [
{
properties: {},
children: [
new Paragraph({
alignment: 'center',
children: [
new TextRun({
text: "Foo Bar",
strike: true,
underline: true,
italics: true,
color: '#e30e0e',
size: 50,
})
]
})
],
},
],
});
// Used to export the file into a .docx file
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});
// Done! A file called 'My Document.docx' will be in your file system.
And here is screenshot of result:
Also if problem is confirmed, maybe you have any suggestions on how to overcome it before problem is solved?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How can i both underline and strikeout text within a footnote?
I'm working with a legal document that makes extensive use of footnotes. The author wants to underline some text, and strike through other ......
Read more >How to Underline, Strikethrough, Subscript, ... in MS Word
Get Microsoft Word *: https://amzn.to/33GMhoq Don't want to wait for ... This also works with Microsoft Office on a Mac and also with...
Read more >Strikethrough in Word w/ Keyboard Shortcuts - YouTube
Learn how to strikethrough text in Microsoft Word using your keyboard shortcuts (it's fast!)SUBSCRIBE to get our latest PowerPoint tips and ...
Read more >Count of Underlined or Struck-Through Words
Still, if your words use simple underlining or simple strikethrough, then these steps will work quickly and easily.
Read more >How to find whether strikeThrough /underline is present in ...
Use the search method in the Word.Body object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is strange that there is an inconsistency there
I have found a fix though
I have updated demo 2 to reflect this
Essentially, you create a style, then apply the style to the run or paragraph
That works fine! Thank you very much for your help and time!