Giter VIP home page Giter VIP logo

Comments (7)

privateOmega avatar privateOmega commented on July 18, 2024

@ankitchauhan27 Could you please post the exact html string that you have used?

from html-to-docx.

privateOmega avatar privateOmega commented on July 18, 2024

Closing the issue due to inactivity.

from html-to-docx.

anirudh-modi avatar anirudh-modi commented on July 18, 2024
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Document</title>
        <style>
        tr{
            color:red;
        }
        </style>
    </head>
    <body>
        <p>Taken from wikpedia</p>
        <img
            src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
            alt="Red dot"
        />
        <p>
            <strong>
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make
                a type specimen book.
            </strong>
            <i>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</i>
            <u>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,</u>and more recently with desktop publishing software
            <span style="color: hsl(0, 75%, 60%);"> like Aldus PageMaker </span>including versions of Lorem Ipsum.
            <span style="background-color: hsl(0, 75%, 60%);">Where does it come from? Contrary to popular belief, Lorem Ipsum is not simply random text.</span>
            It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
        </p>
        <ul style="list-style-type: circle;">
            <li>Unordered list element</li>
        </ul>
        <br>
        <ol style="list-style-type: decimal;">
            <li>Ordered list element</li>
        </ol>
        <br>
        <table style="font-family: arial, sans-serif; border-collapse: collapse; width: 100%;" width="100%">
  <tr>
    <th style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Company</th>
    <th style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Contact</th>
    <th style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Country</th>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Alfreds Futterkiste</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Maria Anders</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Germany</td>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Centro comercial Moctezuma</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Francisco Chang</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Mexico</td>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Ernst Handel</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Roland Mendel</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Austria</td>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Island Trading</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Helen Bennett</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">UK</td>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Laughing Bacchus Winecellars</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Yoshi Tannamuri</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px; background-color: #dddddd;" align="left" bgcolor="#dddddd">Canada</td>
  </tr>
  <tr>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Magazzini Alimentari Riuniti</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Giovanni Rovelli</td>
    <td style="border: 1px solid #dddddd; text-align: left; padding: 8px;" align="left">Italy</td>
  </tr>
</table>
        <br>
        <ul>
            <li>
                <strong>
                    <u>Coffee</u>
                </strong>
            </li>
            <li>Tea
                <ol>
                    <li>Black tea
                        <ol>
                            <li>Srilankan <strong>Tea</strong>
                                <ul>
                                    <li>Uva <b>Tea</b></li>
                                </ul>
                            </li>
                            <li>Assam Tea</li>
                        </ol>
                    </li>
                    <li>Green tea</li>
                </ol>
            </li>
            <li>Milk
                <ol>
                    <li>Cow Milk</li>
                    <li>Soy Milk</li>
                </ol>
            </li>
        </ul>
    </body>
</html>

@privateOmega By default the generated doc is not showing a blank page, however when I upload the same to slack, I have observed it adds a new blank page for its preview..

from html-to-docx.

anirudh-modi avatar anirudh-modi commented on July 18, 2024

example.docx
This is the doc which was generated using this library

from html-to-docx.

privateOmega avatar privateOmega commented on July 18, 2024

@anirudh-modi I have also observed that TBH, but I assumed that was an issue with slack preview parser. I opened this file in Word 2007 and opens without any issues.

from html-to-docx.

anirudh-modi avatar anirudh-modi commented on July 18, 2024

Agree.. however there was definitely some other library named docxjs although I am aware that they take a different approach and don't convert an HTML to DOCX.... But the output from that library worked fine for slack previews...

Could we compare the XML output for both the files?

Perhaps we may have to add an extra attribute somewhere?

from html-to-docx.

privateOmega avatar privateOmega commented on July 18, 2024

@anirudh-modi yes even I used to use that. I made this library partially based on that and because of what it lacks, html-docx-js should be the library you are referring to. What it does is basically make use of a ooxml standard feature called alt chunks which allows embedding html and other markup language code snippets directly inside the docx package file. But the problem associated with it despite it looking good on slack preview, is the limited support it provides, eg the file generated based on that altchunk concept won't work in Google docs, WPS, libre office etc. To be precise, no other software than microsoft word for windows and wasnt even supported until later for Microsoft word for mac. Since this project codebase seems twisted in so many ways, I agree it's not a good solution we want, but it works and it's something I felt we need for the time being.

from html-to-docx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.