jmcnamara / MSVCLibXlsxWriter

A MSVC project to build a Windows DLL for libxlsxwriter
http://libxlsxwriter.github.io
22 stars 15 forks source link
libxlsxwriter ms-visual-studio msvc windows-dll xlsx-files

Note: this method is deprecated in favour of using VCPKG. See the libxlswriter docs: https://libxlsxwriter.github.io/getting_started.html#gsg_vcpkg

MSVCLibXlsxWriter

MSVCLibXlsxWriter is a MSVC project to build a Windows DLL for libxlsxwriter a C library for creating Excel XLSX files.

demo image

Libxlsxwriter is a C library that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.

It supports features such as:

See the full libxlsxwriter documentation for a getting started guide, a tutorial, the main API documentation and examples. Or browse the source code on GitHub.

Building a Windows DLL of libxlsxwriter

The MSVCLibXlsxWriter repository contains 3 directories:

The libxlsxwriter directory is a Git submodule. This means that it isn't included when you do a standard Git clone of MSVCLibXlsxWriter. In order to get the submodule as well as the project code you must clone the project recursively as follows:

git clone --recursive https://github.com/jmcnamara/MSVCLibXlsxWriter.git

Or update it explicitly as follows:

git clone https://github.com/jmcnamara/MSVCLibXlsxWriter.git
cd MSVCLibXlsxWriter/
git submodule init
git submodule update

This version of MSVCLibXlsxWriter contains libxlsxwriter version 0.3.8.

To build the DLL of the library open the LibXlsxWriterProj/LibXlsxWriter.sln project in MS Visual Studio and build the solution using the "Build -> Build Solution" menu item.

In the default configuration this will build an x64 debug LibXlsxWriter .lib and .dll in:

MSVCLibXlsxWriter\LibXlsxWriterProj\x64\Debug

Building a console application using the LibXlsxWriter.lib

Ensure that LibXlsxWriter.lib was built correctly in the previous steps.

To build the example executable open the ExampleExe/ExampleExe.sln project in MS Visual Studio and build the solution using the "Build -> Build Solution" menu item.

In the default configuration this will build the following x64 exe file:

MSVCLibXlsxWriter\ExampleExe\x64\Debug\ExampleExe.exe

To run the application copy the LibXlsxWriter.dll and Zlib.dll files from the MSVCLibXlsxWriter\LibXlsxWriterProj sub-directories to the same directory as the executable. You can then run the application by double clicking on it in File Explorer or by opening a CMD console and running it from the directory.

Once the program has run it will create a chart_column.xlsx file based on the default sample application in ExampleExe.cpp. You can run other libxlsxwriter example programs by copying the code from one of the libxlsxwriter\example\*.c programs.