Documentation Buy Contact Blog

Installing Number Duck on WampServer

30 April 2015

WampServer makes it easy to quickly setup a PHP server for development on your own machine. It can be a little tricky to install PHP plugins especially if it's your first time, so here's a quick guide.

Click to read more

Reporting With Number Duck

23 August 2014

It's that time of the week at Spoon Corp, when the sales department starts pestering you to create their weekly report. They put in a lot of overtime in with the launch of the new Spoon MAX (TM) ultra-wide model that lets you scoop 30% more ice cream and everyone is excited to see the sales numbers.

So you crack open your SQL client and run your queries to generate the data. You did save the queries from the last time you did this didn't you? I hope you aren't writing them again from scratch, this might take hours if that's the case...

Click to read more

Why your users want Excel files, not CSV

21 August 2014

CSV files contain your data in text with each row on its on line and each value separated by a comma hence the name Comma Separated Values. Being simple text, they are easy to naively create from any application, just fopen a text file and start spitting out data. This simplicity has a trade-off tho, as they are harder for your users to work with.

Click to read more

C++ std::string length

20 August 2014

Here is a weird 'feature' of std::strings, string.length() does not always equal strlen(string.c_str()). why is this? It's beacuse of the way std::strings handle the NULL character, which is to say they don't handle it at all.

Click to read more

Nifty Counters

5 August 2014

What is this Nifty Counter of which you speak?

Nifty Counters allow you to make sure that a global object is initialized before any of your code can try to use it. They also allow you to clean up the object after everything has finished using it. Follow the jump for more info about Nifty Counters and a full example.

Click to read more


25 June 2014

Chart! Chart! Chart!

After too many late nights, and long battles with the Excel file format, I'm super excited to release version 2.0 of Number Duck that can create excel files with charts! When I originally started working on Number Duck two years ago, this was the one big feature I wanted to have, and now you get to use it as well to create snazzy spreadsheets with C++!

As with all Number Duck features, I've tried to make it as simple as possible to use, just check out this example and the Api Reference for more info.

You can download the latest release for Windows, Linux, C++ and PHP here.

Users that are upgrading should note that there are some breaking changes. The namespace has been changed from FileScribe to NumberDuck and there is now only one header file you need to include NumberDuck.h.

Click to read more

Number Duck 1.2.0 With Formulas

14 November 2013

The latest update of Number Duck, the coolest programming library for accessing Excel spreadsheets in C++ and PHP, now allows you to read and write formulas. It's super simple, you just set it just like the string you would type into Excel.


Check out the Formula Example and Api Reference for more juicy info.

You can download the latest release for Windows, Linux, C++ and PHP here.

Click to read more

How to use libPng in a C++ project

13 November 2013

Don't ;). Use LodePNG instead. It's super easy to add to your project, unlike libPng with its config files that I didn't have the paitence for. Also, lodePNG does the decompression itself without needing you to add zlib to your project either.

Keep reading to see the example PngLoader class, also check out this post to see the matching JpegLoader class.

Click to read more

Number Duck 1.1.0 With Picture Embedding

29 October 2013

Yay, pictures!

After some painful wrangling with the Excel file format, I'm proud to announce that Number Duck now supports embedding and extracting pictures from your spreadsheets. Like everything else in Number Duck, I've made it super easy to use, as you can see in the Picture Example and the Api Reference for the new Picture class.

You can download the latest release for windows, Linux, C++ and PHP here.

Click to read more

How to use zlib in a C++ project

10 October 2013

zlib is easy to use, and simple to add to your project, especially compared to libJpeg. It's also a prerequisite to adding libPng. Pretty much all you need to do is grab all the *.c and *.h files from the source bundle you can download from and slap them into your project. You probably also want to hold onto the README file.

Like with libJpeg on windows, you'll also need to disable warnings for unsafe function warnings with the compiler flag "/wd4996".

Here's a cool example using zlib to compress and decompress, you can download the full example here here.

#include "zlib/zlib.h"
#include <stdio.h>
#include <string.h>

int main(int argc, char* argv[])
	const unsigned char pData[] = { ... };
	unsigned long nDataSize = 100;

	printf("Initial size: %d\n", nDataSize);

	unsigned long nCompressedDataSize = nDataSize;
	unsigned char * pCompressedData = new unsigned char[nCompressedDataSize];
	int nResult = compress2(pCompressedData, &nCompressedDataSize, pData, nDataSize, 9);

	if (nResult == Z_OK)
		printf("Compressed size: %d\n", nCompressedDataSize);

		unsigned char * pUncompressedData = new unsigned char[nDataSize];
		nResult = uncompress(pUncompressedData, &nDataSize, pCompressedData, nCompressedDataSize);
		if (nResult == Z_OK)
			printf("Uncompressed size: %d\n", nDataSize);
			if (memcmp(pUncompressedData, pData, nDataSize) == 0)
				printf("Great Success\n");
		delete [] pUncompressedData;

	delete [] pCompressedData;

	return 0;

Click to read more

How to use libJpeg in a C++ project

9 October 2013

Altho I do love how simple to integrate and use stb_image is when I can control the input images, I needed something a bit more heavy duty for Number Duck. This is because users will be supplying their own images, and they could submit something a bit more exotic than stb_image is able to handle. Things like interlaced and CMYK JPEGs.

Supposedly you should be using cmake or something to create the project files, but I wanted to quickly and simply get the code building under my own project. All in all it's pretty simple, it mainly involves grabbing the latest source release, configuring and pruning the unneeded files. Read on to for the full instructions, a simple example using libJpeg and the pre pruned library itself if you are feeling lazy.

Click to read more

DocuDuck - C++ API Reference Building and Validating

16 September 2013

Since Number Duck is a programming library built to be used by others, I'm putting a lot of work into having good documentation. So, along with fun examples, I have developed DocuDuck, a PHP script that will generate the HTML API reference for as part of the automated build process. Also, DocuDuck checks the documented functions against the actual C++ code, and will error if anything is out of date or missing, thus failing the build.

You can download DocuDuck here. It includes all the dependencies to run on windows, but you'll need to have PHP and SWIG installed to run it on Linux. Below is a description of how it works and how to set it up for use with your own projects.

Click to read more