vworld4u/office-converter

语言: JavaScript

git: https://github.com/vworld4u/office-converter

用于将办公文档(文档/ excel /演示文稿)转换为PDF / HTML的NPM实用程序
A NPM Utility program to convert office documents (documents/excel/presentations) into PDF/HTML
README.md (中文)

办公转换器

用于将office文档转换为PDF或HTML的节点模块。

它需要安装unoconv并在PATH中。它可以将任何可在Open Office [或Libre Office]中打开的办公文档(doc / docx / xls / xlsx / ppt / pptx)转换为PDF或HTML。

用法

``` var converter = require('office-converter')();   converter.generatePdf('input / test.xls',function(err,result){     //如果没有错误,则处理结果     if(result.status === 0){       console.log('输出文件位于'+ result.outputFile);     }   });   converter.generateHtml('input / test.docx',function(err,result){     //如果没有错误,则处理结果     if(result.status === 0){       console.log('输出文件位于'+ result.outputFile);     }   });

```

怎么测试?

测试文件夹中有测试用例。您可以使用npm测试来测试包。测试导致输入文件夹中的test.pdf。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

office-converter

A node module to convert office documents into either PDF or HTML.

It requires requires unoconv to be installed and in the PATH. It can convert any office document (doc/docx/xls/xlsx/ppt/pptx) which can be opened in Open Office [Or Libre Office] to either PDF or HTML.

Usage

```
var converter = require('office-converter')();
converter.generatePdf('input/test.xls', function(err, result) {
// Process result if no error
if (result.status === 0) {
console.log('Output File located at ' + result.outputFile);
}
});
converter.generateHtml('input/test.docx', function(err, result) {
// Process result if no error
if (result.status === 0) {
console.log('Output File located at ' + result.outputFile);
}
});

```

How to test?

There are test cases inside tests folder. You can test using npm test to test the package. Tests result in test.pdf inside input folder.