Giter Site home page Giter Site logo

xlnt-wasm's Introduction

WebAssembly bindings for the XLNT library

NPM

https://www.npmjs.com/package/xlnt

Blog posts

I'm writing a series of posts in my blog about porting C++ to WASM.
You can take a look here: Excel-ent experiment with WebAssembly

Demo

Simple test and proof of concept in JavaScript that exports a HTML table to excel (with rowspan and colspan)

<script src="./xlnt.js"></script>
<script>
    load_xlnt().then(function(xlnt)
    {
        book = new xlnt.workbook();
        sheet = book.active_sheet();

        sheet.using_cell("B2", c => c.set_value("asd"));

        book.download("demo.xlsx");
        
        sheet.delete();
        book.delete();
    });
</script>

xlnt-wasm's People

Contributors

isc30 avatar

Stargazers

tckxjzc avatar Meta avatar Jinming Chen avatar  avatar Meta avatar mrcuix avatar Cheiron avatar Danton Heuer avatar  avatar  avatar Niall avatar Austin Turner avatar kaffa avatar Nick Gao avatar soloproc avatar William McGann avatar  avatar yohei yamana avatar Milan Raj avatar  avatar  avatar Dmitry Ilyin avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar Meta avatar

xlnt-wasm's Issues

UTF8

Ivan, so the project with the possibility to export pivot tables to excel ;) now encountered that this implementation doesn't support non-ASCII characters.

For example, this fails:

sheet.using_cell("A1", c => c.set_value('ฤ…'));

I suspect (see emscripten-core/emscripten#7174 (comment)) that the binary should be recompiled with -s EMBIND_STD_STRING_IS_UTF8=1. From your experience, will that help? And may I ask you to recompile the .wasm file?

Thanks.

Mikhail

compiling the project

I'm trying to compile this project

I then run emcmake cmake -G "Unix Makefiles" . followed by emmake make

But all I get is a lot of errors (the complete output is attached below).

Can you point me to the right direction to build it from the sources?

make: ['make']
[  1%] Building CXX object xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:81:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstddef:38:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:81:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstddef:51:9: error: no member named 'size_t' in the global namespace
using ::size_t;
      ~~^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:82:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstdlib:86:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/stdlib.h:94:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat/stdlib.h:14:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:38:15: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *malloc (size_t);
              ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:38:21: error: expected expression
void *malloc (size_t);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:15: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *calloc (size_t, size_t);
              ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:21: error: expected expression
void *calloc (size_t, size_t);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:23: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *calloc (size_t, size_t);
                      ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:40:24: error: unknown type name 'size_t'
void *realloc (void *, size_t);
                       ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:42:21: error: unknown type name 'size_t'
void *aligned_alloc(size_t alignment, size_t size);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:42:39: error: unknown type name 'size_t'
void *aligned_alloc(size_t alignment, size_t size);
                                      ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:44: error: C++ requires a type specifier for all declarations
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                           ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:52: error: C++ requires a type specifier for all declarations
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                                   ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:52: error: redefinition of parameter 'size_t'
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:44: note: previous declaration is here
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                           ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:21: error: C++ requires a type specifier for all declarations
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:29: error: C++ requires a type specifier for all declarations
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                            ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:29: error: redefinition of parameter 'size_t'
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:21: note: previous declaration is here
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:70:26: error: unknown type name 'size_t'
int mblen (const char *, size_t);
                         ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:71:58: error: unknown type name 'size_t'
int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
                                                         ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:73:1: error: unknown type name 'size_t'
size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
shared:ERROR: '$HOME/src/sdk/emsdk/fastcomp/fastcomp/bin/clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=43 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libcxxabi/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/local/include -DEMSCRIPTEN -DLIBSTUDXML_STATIC_LIB=1 -DXML_STATIC=1 -I$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml -std=gnu++11 -c $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx -Xclang -disable-O0-optnone -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/SDL -c -o CMakeFiles/libstudxml.dir/xml/parser.cxx.o -emit-llvm' failed (1)
make[2]: *** [xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/build.make:64: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

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.