Comments (7)
@ankitchauhan27 Could you please post the exact html string that you have used?
from html-to-docx.
Closing the issue due to inactivity.
from html-to-docx.
<!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.
example.docx
This is the doc which was generated using this library
from html-to-docx.
@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.
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.
@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)
- imgs with src as base64 do not come over
- Is width = 100% achievable?
- How to resize images - is it possible?
- Images & style doesn't apply well in .docx file HOT 4
- html to docx conversion raise an error when it transform a table with merged cell
- Margins don't work
- ADD page break if content doesn't have enough room
- XML error when using with Vite (React or Vue)
- browser webpack error
- How to preserve border-bottom without table
- Refactoring work done HOT 4
- bug: when an image is nested under spans, xml-builder doesn't pick up the img tag
- README.md does not show how to load the HTMLtoDOCX function HOT 2
- Nested formatting tags are not getting applied
- STRIKE THROUGH Not working HOT 3
- Reference error : ReferenceError: HTMLToDOCX is not defined.
- Uncaught TypeError: Class extends value undefined is not a constructor or null
- ul element not properly displayed HOT 1
- Nuxt 3 (no SSR)+ Vite not working - Cannot read properties of undefined (reading 'prototype')
- Cannot read properties of undefined (reading 'getVNodeKey')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-to-docx.