Git Product home page Git Product logo

word-to-html's Introduction

word-to-html

feature

  • images
  • font-size color/style
  • table
  • link

example

var path = require("path");
var Word2html = require("word-to-html");
//Word document's absolute path
var absPath = path.join(__dirname, "test.docx");

const word2html = new Word2html(
    absPath,
    {
        outputDir: path.resolve(__dirname, 'temp')
    }
);
word2html.convert();

event

zipReady

  • callback <Function>
    • zip <admZip>

you can use zip to get any resource you need, like images; adm-zip

var path = require("path");
var Word2html = require("word-to-html");
//Word document's absolute path
var absPath = path.join(__dirname, "test.docx");

const word2html = new Word2html(
    absPath,
    {
        outputDir: path.resolve(__dirname, 'temp')
    }
);
word2html.on('zipReady', (zip) => {
    // https://github.com/cthackers/adm-zip/wiki/ADM-ZIP#introduction
    zip.getEntries();
    // extractAllTo
    zip.extractAllTo(path.resolve(__dirname, 'temp/entryfiles'));
});
word2html.convert();

word-to-html's People

Contributors

buptlhuanyu avatar

Stargazers

Rongbin avatar  avatar Murad Khalimov avatar  avatar  avatar magao avatar 流浪大法师 avatar  avatar Liu Anchuang avatar 刘朝旭 avatar raybon.lee avatar fang avatar jiangwenyong avatar John Nguyen avatar Md. Rashidul Hasan avatar  avatar Olivier Heimerdinger avatar 羊支甘陆 avatar Wang Bing avatar 木头981 avatar Paisley Flores avatar  avatar

Watchers

James Cloos avatar Olivier Heimerdinger avatar  avatar

word-to-html's Issues

getAttribute error

Hi! I get this error: TypeError: Cannot read properties of undefined (reading 'getAttribute'). This is my code, typed in Node:

var path = require("path");
var Word2html = require("word-to-html");
//Word document's absolute path
var absPath = path.join(__dirname, "Vraciloblaga.docx");

const word2html = new Word2html(
absPath,
{
outputDir: path.resolve(__dirname, 'temp')
}
);

word2html.on('zipReady', zip => {
zip.extractAllTo(path.resolve(__dirname, 'temp/entryfiles'));
});
word2html.convert();

Does this support format of text?

[Chinese]
看到源代码里的注释是中文,我先用中文来写以提高沟通效率。

我现在面临一个将Word文件内容展现在网页里的任务,发现了你这个库。想咨询一下,这个库是否支持把Word里的文字格式(字体、大小、颜色……)也一同转化入HTML?

简单看了一下源代码,好像对表格有很好的支持和处理,但对文本,只是把 <w:r><w:t> 里的内容抽取出来,中间的格式(通常包含在 <w:rPr> 之类里的内容并没有抽取。

不知道是我看漏了,还是目前暂时还不支持?

[English]

To make others also understand the question, I simply summarize my question in English also.

I notice this library supports tables in Word file well, but didn't find the part to support the format or style of text, usually defined in <w:rPr> tag in Office Open XML.

Does this library really not support styles of text currently?

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.