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

STRIKE THROUGH Not working #237

Open
satyajitnayk opened this issue Feb 15, 2024 · 3 comments
Open

STRIKE THROUGH Not working #237

satyajitnayk opened this issue Feb 15, 2024 · 3 comments

Comments

@satyajitnayk
Copy link

satyajitnayk commented Feb 15, 2024

This commit seems to be implementing strike through feature. but it does not work

Code to reproduce

const fs = require('fs');
const HTMLtoDOCX = require('html-to-docx');
const filePath = './example.docx';

const htmlString = `<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Document</title>
    </head>
    <body>
        <s>STRIKE</s>
        <del>STRIKE</del>
    </body>
</html>`;

(async () => {
  const fileBuffer = await HTMLtoDOCX(htmlString, null, {
    table: { row: { cantSplit: true } },
    footer: true,
    pageNumber: true,
  });

  fs.writeFile(filePath, fileBuffer, (error) => {
    if (error) {
      console.log('Docx file creation failed');
      return;
    }
    console.log('Docx file created successfully');
  });
})();

example.docx
output DOCX:
image

@satyajitnayk satyajitnayk changed the title <s>STRIKE THROUGH</s> Not working STRIKE THROUGH Not working Feb 15, 2024
@satyajitnayk
Copy link
Author

satyajitnayk commented Feb 15, 2024

  • Hello @privateOmega . I have fix for this one(small change). If you want I can create a PR 😇
  • You missed assigning tempAttributes.strike = true; inside buildRun() for case 's' & 'del' & 'strike' tags here.
  • Thats why <w:strike/> missing from final DOCX document.xml.

@maxping76
Copy link

Same problem, please accept PR from @satyajitnayk

@ccamba
Copy link

ccamba commented Jun 25, 2024

Hi @privateOmega, can give a solution please !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants