Documentation Buy Contact Blog
Api Reference
Workbook

Provides read/write access to Excel .xls files.

Workbook(const char* szRegistrationKey)
~Workbook()
void Clear()
bool Load(const char* szFileName)
bool Save(const char* szFileName)
uint16_t GetNumWorksheet()
Worksheet* GetWorksheetByIndex(unsigned int nIndex)
Worksheet* CreateWorksheet()
void PurgeWorksheet(unsigned int nIndex)
uint16_t GetNumStyle()
Style* GetStyleByIndex(uint16_t nIndex)
Style* GetDefaultStyle()
Style* CreateStyle()


Worksheet

Provides access to cells and other stuff of a worksheet.

const char* GetName()
bool SetName(const char* szName)
Worksheet::Orientation GetOrientation()
void SetOrientation(Worksheet::Orientation eOrientation)
uint16_t GetColumnWidth(uint16_t nColumn)
void SetColumnWidth(uint16_t nColumn, uint16_t nWidth)
bool GetColumnHidden(uint16_t nColumn)
void SetColumnHidden(uint16_t nColumn, bool bHidden)
void InsertColumn(uint16_t nColumn)
void DeleteColumn(uint16_t nColumn)
uint16_t GetRowHeight(uint16_t nRow)
void SetRowHeight(uint16_t nRow, uint16_t nHeight)
void InsertRow(uint16_t nRow)
void DeleteRow(uint16_t nRow)
Cell* GetCellByAddress(const char* szAddress)
Cell* GetCell(uint16_t nX, uint16_t nY)
Cell* GetCellByRC(uint16_t nRow, uint16_t nColumn)
uint16_t GetNumPicture()
Picture* GetPictureByIndex(uint16_t nIndex)
Picture* CreatePicture(const char* szFileName)
void PurgePicture(uint16_t nIndex)
uint16_t GetNumChart()
Chart* GetChartByIndex(uint16_t nIndex)
Chart* CreateChart(Chart::Type eType)
void PurgeChart(uint16_t nIndex)
uint16_t GetNumMergedCell()
MergedCell* GetMergedCellByIndex(uint16_t nIndex)
MergedCell* CreateMergedCell(uint16_t nX, uint16_t nY, uint16_t nWidth, uint16_t nHeight)
void PurgeMergedCell(uint16_t nIndex)


Cell

Cell objects give access to the properties of a single cell.

bool Equals(const NumberDuck::Cell* pCell) const
const Value* GetValue()
Value::Type GetType()
void Clear()
void SetString(const char* szString)
const char* GetString()
void SetFloat(double fFloat)
double GetFloat()
void SetBoolean(bool bBoolean)
bool GetBoolean()
void SetFormula(const char* szFormula)
const char* GetFormula()
const Value* EvaulateFormula() const
Style* GetStyle()
bool SetStyle(Style* pStyle)


Value

A Value is an object that can contain different types of values.

bool Equals(const Value* pValue) const
Value::Type GetType() const
const char* GetString() const
double GetFloat() const
bool GetBoolean() const
const char* GetFormula() const
const Value* EvaulateFormula() const


Style

Used for styling cells.

Font* GetFont()
Style::HorizontalAlign GetHorizontalAlign()
void SetHorizontalAlign(Style::HorizontalAlign eHorizontalAlign)
Style::VerticalAlign GetVerticalAlign()
void SetVerticalAlign(NumberDuck::Style::VerticalAlign eVerticalAlign)
const Color* GetBackgroundColor()
void SetBackgroundColor(const Color color)
void ClearBackgroundColor()
Line* GetTopBorderLine()
Line* GetRightBorderLine()
Line* GetBottomBorderLine()
Line* GetLeftBorderLine()
const char* GetFormat()
void SetFormat(const char* szFormat)


Color

RGB color information. Used by the Style class.

Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)
bool Equals(const NumberDuck::Color* pColor) const
uint8_t GetRed() const
void SetRed(uint8_t nRed)
uint8_t GetGreen() const
void SetGreen(uint8_t nGreen)
uint8_t GetBlue() const
void SetBlue(uint8_t nBlue)
uint32_t GetRgba() const


Picture

Represents an embedded picture inside a worksheet.

uint16_t GetX()
bool SetX(uint16_t nX)
uint16_t GetY()
bool SetY(uint16_t nY)
uint16_t GetSubX()
void SetSubX(uint16_t nSubX)
uint16_t GetSubY()
void SetSubY(uint16_t nSubY)
uint16_t GetWidth()
void SetWidth(uint16_t nWidth)
uint16_t GetHeight()
void SetHeight(uint16_t nHeight)
const char* GetUrl()
void SetUrl(const char* szUrl)
const uint8_t* GetData()
uint32_t GetDataSize()
Picture::Format GetFormat()


Chart

Represents an embedded chart inside a worksheet.

uint16_t GetX()
bool SetX(uint16_t nX)
uint16_t GetY()
bool SetY(uint16_t nY)
uint16_t GetSubX()
void SetSubX(uint16_t nSubX)
uint16_t GetSubY()
void SetSubY(uint16_t nSubY)
uint16_t GetWidth()
void SetWidth(uint16_t nWidth)
uint16_t GetHeight()
void SetHeight(uint16_t nHeight)
Chart::Type GetType()
void SetType(Chart::Type eType)
uint16_t GetNumSeries()
Series* GetSeriesByIndex(uint16_t nIndex)
Series* CreateSeries(const char* szValues)
void PurgeSeries(uint16_t nIndex)
const char* GetCategories()
bool SetCategories(const char* szCategories)
const char* GetTitle()
void SetTitle(const char* szTitle)
const char* GetHorizontalAxisLabel()
void SetHorizontalAxisLabel(const char* szHorizontalAxisLabel)
const char* GetVerticalAxisLabel()
void SetVerticalAxisLabel(const char* szVerticalAxisLabel)
Legend* GetLegend()
Line* GetFrameBorderLine()
Fill* GetFrameFill()
Line* GetPlotBorderLine()
Fill* GetPlotFill()
Line* GetHorizontalAxisLine()
Line* GetHorizontalGridLine()
Line* GetVerticalAxisLine()
Line* GetVerticalGridLine()


Series

Represents a data series inside this Chart.

const char* GetName()
bool SetName(const char* szName)
const char* GetValues()
bool SetValues(const char* szValues)
Line* GetLine()
Fill* GetFill()
Marker* GetMarker()


Legend

Represents the legend inside of a Chart.

bool GetHidden() const
void SetHidden(bool bHidden)
Line* GetBorderLine()
Fill* GetFill()


Font

Used in various places to style text.

const char* GetName()
void SetName(const char* szName)
uint8_t GetSize()
void SetSize(uint8_t nSize)
const Color* GetColor()
void SetColor(const Color color)
void ClearColor()
bool GetBold()
void SetBold(bool bBold)
bool GetItalic()
void SetItalic(bool bItalic)
Font::Underline GetUnderline()
void SetUnderline(Font::Underline eUnderline)


Line

Lines are used to style different sections of Charts.

bool Equals(const Line* pLine) const
Line::Type GetType() const
void SetType(Line::Type eType)
const Color* GetColor() const
void SetColor(const Color color)


Fill

Used to modify the fill color of different sections of Charts.

bool Equals(const Fill* pFill) const
Fill::Type GetType() const
void SetType(Fill::Type eType)
const Color* GetForegroundColor() const
void SetForegroundColor(const Color foregroundColor)
const Color* GetBackgroundColor() const
void SetBackgroundColor(const Color backgroundColor)


Marker

Marker are used to style markers on Line Charts.

bool Equals(const Marker* pMarker) const
Marker::Type GetType() const
void SetType(Marker::Type eType)
const Color* GetFillColor() const
void SetFillColor(const Color fillColor)
void ClearFillColor()
const Color* GetBorderColor() const
void SetBorderColor(const Color borderColor)
void ClearBorderColor()
uint16_t GetSize() const
void SetSize(uint16_t nSize)


MergedCell

Allows you to modify merged cells that have been previously defined.

uint16_t GetX() const
void SetX(uint16_t nX)
uint16_t GetY() const
void SetY(uint16_t nY)
uint16_t GetWidth() const
void SetWidth(uint16_t nWidth)
uint16_t GetHeight() const
void SetHeight(uint16_t nHeight)


Workbook

Provides read/write access to Excel .xls files.

Workbook(const char* szRegistrationKey)

Unassuming constructor.

If you have purchased Number Duck, pass in your registration key here to remove annoying watermarks, otherwise just pass in an empty string or NULL.

~Workbook()

Resolute destructor.

void Clear()

Clears this workbook back to defaults. The same result as deleting the object and constructing it again.

bool Load(const char* szFileName)

Loads a .xls file from disk.

Currently only simple Excel .xls formatted files are supported.

Returns false on error.

A common error in loading is that the file is locked because it is already open in Excel.

bool Save(const char* szFileName)

Saves the current workbook to disk in Excel .xls format.

Returns false on error.

Eg: pWorkbook->Save("BananaReport.xls");

uint16_t GetNumWorksheet()

Returns the number of worksheets available.

Worksheet* GetWorksheetByIndex(unsigned int nIndex)

Returns a pointer to the Worksheet from the given index.

Returns NULL if the given index is out of range.

Worksheet* CreateWorksheet()

Creates a new Worksheet and returns a pointer to it.

If the workbook already has the maximum allowed number of worksheets, this function returns null.

void PurgeWorksheet(unsigned int nIndex)

Deletes the Worksheet at the given index.

uint16_t GetNumStyle()

Returns the number of existing Styles available in this Workbook.

More styles may be created with the CreateStyle function.

Style* GetStyleByIndex(uint16_t nIndex)

Returns the Style at the given index.

Returns NULL if you give an out of range index like a silly person.

Style* GetDefaultStyle()

Returns the default Style for this Workbook.

This is a simple wrapper for GetStyleByIndex(0).

Style* CreateStyle()

Creates a new Style and returns a pointer to it.

Using this pointer you can set all the pretties for a Cell.

Worksheet

Provides access to cells and other stuff of a worksheet.

const char* GetName()

Returns the name of the worksheet in UTF8.

bool SetName(const char* szName)

Sets the name of the worksheet. Returns false if the name is already in use by another Worksheet.

szName is a UTF8 string.

Worksheet::Orientation GetOrientation()

Returns the orientation of the worksheet for printing.

Possible orientations are:

  • Worksheet::ORIENTATION_PORTRAIT
  • Worksheet::ORIENTATION_LANDSCAPE

void SetOrientation(Worksheet::Orientation eOrientation)

Sets the page orientation for printing.

See Worksheet::SetOrientation for a list of possible orientations.

uint16_t GetColumnWidth(uint16_t nColumn)

Returns the width of the given column in pixels.

void SetColumnWidth(uint16_t nColumn, uint16_t nWidth)

Sets the width of the column in pixels.

bool GetColumnHidden(uint16_t nColumn)

Returns true if the given column is hidden.

void SetColumnHidden(uint16_t nColumn, bool bHidden)

Allows you to show or hide the given column.

void InsertColumn(uint16_t nColumn)

Inserts a column before the given one.

The 255th column is removed to make room for it.

void DeleteColumn(uint16_t nColumn)

Deletes the given column.

uint16_t GetRowHeight(uint16_t nRow)

Returns the height of the given row in pixels.

void SetRowHeight(uint16_t nRow, uint16_t nHeight)

Sets the pixel height of the given row of the worksheet.

void InsertRow(uint16_t nRow)

Inserts a row before the given one.

The 65535th row is removed to make room for it.

void DeleteRow(uint16_t nRow)

Deletes the given row.

Cell* GetCellByAddress(const char* szAddress)

Returns the Cell at the address given.

Eg: pWorksheet->GetCell("B5");

Cell* GetCell(uint16_t nX, uint16_t nY)

Returns the Cell at the zero based coordinates given.

Eg: pWorkSheet->GetCell(1, 4); // same as pWorksheet->GetCell("B5");

Cell* GetCellByRC(uint16_t nRow, uint16_t nColumn)

Returns the Cell at the RC coordinates given.

Eg: pWorkSheet->GetCell(1, 1); // same as pWorksheet->GetCell("A1");

uint16_t GetNumPicture()

Returns the number of pictures embedded in this worksheet.

Picture* GetPictureByIndex(uint16_t nIndex)

Returns a pointer to the Picture from the given index.

Returns NULL if the given index is out of range.

Picture* CreatePicture(const char* szFileName)

Creates a new Picture and returns a pointer to it.

szFileName is the path to a PNG or JPEG file.

Returns NULL if szFileName file cannout be found or is the wrong format.

void PurgePicture(uint16_t nIndex)

Deletes the Picture at the given index.

uint16_t GetNumChart()

Returns the number of charts embedded in this worksheet.

Chart* GetChartByIndex(uint16_t nIndex)

Returns a pointer to the Chart from the given index.

Returns NULL if the given index is out of range.

Chart* CreateChart(Chart::Type eType)

Creates a new Chart and returns a pointer to it.

See Chart::GetType for a list of possible types.

Eg: pWorksheet->CreateChart(Chart::TYPE_AREA);

void PurgeChart(uint16_t nIndex)

Deletes the Chart at the given index.

uint16_t GetNumMergedCell()

Returns the number of merged cells in this worksheet.

MergedCell* GetMergedCellByIndex(uint16_t nIndex)

Returns a pointer to the MergedCell from the given index.

Returns NULL if the given index is out of range.

MergedCell* CreateMergedCell(uint16_t nX, uint16_t nY, uint16_t nWidth, uint16_t nHeight)

Creates a new MergedCell and returns a pointer to it.

Returns NULL if the given coordinates are out of range.

void PurgeMergedCell(uint16_t nIndex)

Deletes the MergedCell at the given index, unmerging the cells.

Cell

Cell objects give access to the properties of a single cell. This is all pretty straightforward right?

bool Equals(const NumberDuck::Cell* pCell) const

Comparison function, returns true if this cell matches the one given.

Eg: If both cells contain the same number.

const Value* GetValue()

Returns the value in this cell.

Most of the time you will not need this, unless you want to easily compare the result of a formula against a cell.

Value::Type GetType()

Returns the type of the contents of this cell.

Possible types are:

  • Value::TYPE_EMPTY
  • Value::TYPE_STRING
  • Value::TYPE_FLOAT
  • Value::TYPE_BOOLEAN
  • Value::TYPE_FORMULA

void Clear()

Clears this cell back to a pristine untouched state.

void SetString(const char* szString)

Stores the given string in the cell.

A cell may only store a single type of value at a time, eg: string, float, boolean, formula etc.

const char* GetString()

Returns the string stored in this cell.

If the cell type is not TYPESTRING this function will return an empty string. Use _GetType to check.

void SetFloat(double fFloat)

Stores the given float in the cell.

A cell may only store a single type of value at a time, eg: string, float, boolean, formula etc.

double GetFloat()

Returns the float stored in this cell.

If the cell type is not TYPEFLOAT this function will return 0.0. Use _GetType to check.

void SetBoolean(bool bBoolean)

Stores the given boolean in the cell.

A cell may only store a single type of value at a time, eg: string, float, boolean, formula etc.

bool GetBoolean()

Returns the boolean stored in this cell.

If the cell type is not TYPEBOOLEAN this function will return false. Use _GetType to check.

void SetFormula(const char* szFormula)

Stores the given formula in the cell.

A cell may only store a single type of value at a time, eg: string, float, boolean, formula etc.

Eg: pCell->SetFormula("=SUM(A1:A5)");

const char* GetFormula()

Returns the formula stored in this cell. The formula will be prefixed with "=".

If the cell type is not TYPEFORMULA this function will return "=". Use _GetType to check.

const Value* EvaulateFormula() const

Evaluates the formula stored in this cell and returns the result as a Value.

If the cell type is not TYPEFORMULA this function will return a _Value of TYPEERROR. Use _GetType to check.

Style* GetStyle()

Gets the current Style applied to this cell.

Compare against Workbook::GetDefaultStyle to see if this cell is using default styling.

bool SetStyle(Style* pStyle)

Sets the Style used by this cell.

Use Workbook::CreateStyle to create a new style.

Or use Cell::GetStyle or Workbook::GetStyleByIndex to use an existing style.

Returns false on error, usually if you try to pass in a NULL pointer or a Style that comes from a different workbook.

Value

A Value is an object that can contain different types of values.

bool Equals(const Value* pValue) const

Comparison function, returns true if this value matches the one given.

Value::Type GetType() const

Returns the type of the contents of this cell.

Possible types are:

  • TYPE_EMPTY
  • TYPE_STRING
  • TYPE_FLOAT
  • TYPE_BOOLEAN
  • TYPE_FORMULA

If this Value is the result of a formula evaluation, it may also be: TYPE_ERROR.

const char* GetString() const

Returns the string stored in this Value.

If the Value type is not TYPESTRING this function will return an empty string. Use _GetType to check.

double GetFloat() const

Returns the float stored in this Value.

If the Value type is not TYPEFLOAT this function will return 0.0. Use _GetType to check.

bool GetBoolean() const

Returns the boolean stored in this Value.

If the Value type is not TYPEBOOLEAN this function will return false. Use _GetType to check.

const char* GetFormula() const

Returns the formula stored in this Value. The formula will be prefixed with "=".

If the Value type is not TYPEFORMULA this function will return "=". Use _GetType to check.

const Value* EvaulateFormula() const

Evaluates the formula stored in this Value and returns the result as a Value.

If the Value type is not TYPEFORMULA this function will return a _Value of TYPEERROR. Use _GetType to check.

Style

Used for styling cells.

Use Workbook::CreateStyle to create a new style.

Or use Cell::GetStyle or Workbook::GetStyleByIndex to use an existing Style.

Font* GetFont()

Returns a pointer to a Font for changing font pretties.

Style::HorizontalAlign GetHorizontalAlign()

Returns horizontal alignment of text for this Style.

Possible types are:

  • HORIZONTAL_ALIGN_GENERAL
  • HORIZONTAL_ALIGN_LEFT
  • HORIZONTAL_ALIGN_CENTER
  • HORIZONTAL_ALIGN_RIGHT
  • HORIZONTAL_ALIGN_FILL
  • HORIZONTAL_ALIGN_JUSTIFY
  • HORIZONTAL_ALIGN_CENTER_ACROSS_SELECTION
  • HORIZONTAL_ALIGN_DISTRIBUTED

void SetHorizontalAlign(Style::HorizontalAlign eHorizontalAlign)

Sets the type of horizontal alignment used by this Style.

See Style::GetHorizontalAlign for the list of possible alignment types.

Eg: pStyle->SetHorizontalAlign(NumberDuck::Style::HORIZONTAL_ALIGN_GENERAL);

Style::VerticalAlign GetVerticalAlign()

Returns vertical alignment of text for this Style.

Possible types are:

  • VERTICAL_ALIGN_TOP
  • VERTICAL_ALIGN_CENTER
  • VERTICAL_ALIGN_BOTTOM
  • VERTICAL_ALIGN_JUSTIFY
  • VERTICAL_ALIGN_DISTRIBUTED

void SetVerticalAlign(NumberDuck::Style::VerticalAlign eVerticalAlign)

Sets the type of vertical alignment used by this Style.

See Style::GetVerticalAlign for the list of possible alignment types.

Eg: pStyle->SetVerticalAlign(NumberDuck::Style::VERTICAL_ALIGN_CENTER);

const Color* GetBackgroundColor()

Returns the background color.

void SetBackgroundColor(const Color color)

Sets the background color.

Eg: pStyle->SetBackgroundColor(NumberDuck::Color(0x00, 0x00, 0xFF));

void ClearBackgroundColor()

Clears the background color.

Note that clear is different from white. The white comes from the users system settings so it could in fact be any color.

Line* GetTopBorderLine()

Returns the Line for the top border.

Line* GetRightBorderLine()

Returns the Line for the right border.

Line* GetBottomBorderLine()

Returns the Line for the bottom border.

Line* GetLeftBorderLine()

Returns the Line for the left border.

const char* GetFormat()

Returns the formattig for this _Style, which controls how Excel displays numbers and text.

Todo: moar info

void SetFormat(const char* szFormat)

Sets the formatting used by this Style.

Note that Number Duck does not validate the format entered, and if it is invalid, Excel will pop up an error when opening the file.

It's best to escape question marks, to avoid your compiler interperating them as trigraphs ("??/" being converted to "\").

Eg: pStyle->SetFormat("m/d/yy h:mm");

Color

RGB color information. Used by the Style class.

Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)

Constructor.

Eg: pStyle->SetColor(NumberDuck::Color(0x00, 0xFF, 0x00));

bool Equals(const NumberDuck::Color* pColor) const

Returns true if this Color matches the one given.

uint8_t GetRed() const

Returns the red value of this color.

void SetRed(uint8_t nRed)

Sets the red value of this color.

uint8_t GetGreen() const

Returns the green value of this color.

void SetGreen(uint8_t nGreen)

Sets the red value of this color.

uint8_t GetBlue() const

Returns the blue value of this color.

void SetBlue(uint8_t nBlue)

Sets the blue value of this color.

uint32_t GetRgba() const

Returns the this color as a 32bit RGBA int.

Picture

Represents an embedded picture inside a worksheet.

Use Workbook::CreatePicture to create a new picture from an image on disk. Or use Workbook::GetPictureByIndex to get an existing picture.

Pictures can only be created from PNG or JPEG files. Existing pictures already embedded in the spreadsheet can be any format.

uint16_t GetX()

Returns the column where the top left corner of the picture is anchored.

bool SetX(uint16_t nX)

Sets the column where top left corner of the picture is anchored.

Returns false if an out of bounds column is given.

uint16_t GetY()

Returns the row where the top left corner of the picture is anchored.

bool SetY(uint16_t nY)

Sets the row where top left corner of the picture is anchored.

Returns false if an out of bounds row is given.

uint16_t GetSubX()

Returns the horizontal pixel offset of the picture within the cell given by GetX() and GetY().

void SetSubX(uint16_t nSubX)

Sets the horizontal pixel offset of this picture inside the cell.

uint16_t GetSubY()

Returns the vertical pixel offset of the picture within the cell given by GetX() and GetY().

void SetSubY(uint16_t nSubY)

Sets the vertical pixel offset of this picture inside the cell.

uint16_t GetWidth()

Returns the width of the pitcure, in pixels.

void SetWidth(uint16_t nWidth)

Sets the width of the picture, in pixels.

uint16_t GetHeight()

Returns the height of the pitcure, in pixels.

void SetHeight(uint16_t nHeight)

Sets the height of the picture, in pixels.

const char* GetUrl()

Returns the url linked to from this picture, or an empty string if there is no link.

void SetUrl(const char* szUrl)

Sets the url this picture is linked to. Pass an empty string to not link to anything.

const uint8_t* GetData()

Returns the binary data for this image.

See GetFormat() for what image format this data is in.

uint32_t GetDataSize()

Returns the size of the binary data returned by GetData().

Picture::Format GetFormat()

Returns the image format of the data given by GetData().

Possible types are:

  • FORMAT_PNG
  • FORMAT_JPEG
  • FORMAT_EMF
  • FORMAT_WMF
  • FORMAT_PICT
  • FORMAT_DIB
  • FORMAT_TIFF

Chart

Represents an embedded chart inside a worksheet.

Use Workbook::CreateChart to create. Or use Workbook::GetChartByIndex to get an existing chart.

uint16_t GetX()

Returns the column where the top left corner of the chart is anchored.

bool SetX(uint16_t nX)

Sets the column where top left corner of the chart is anchored.

Returns false if an out of bounds column is given.

uint16_t GetY()

Returns the row where the top left corner of the chart is anchored.

bool SetY(uint16_t nY)

Sets the row where top left corner of the chart is anchored.

Returns false if an out of bounds row is given.

uint16_t GetSubX()

Returns the horizontal pixel offset of the chart within the cell given by GetX() and GetY().

void SetSubX(uint16_t nSubX)

Sets the horizontal pixel offset of this chart inside the cell.

uint16_t GetSubY()

Returns the vertical pixel offset of the chart within the cell given by GetX() and GetY().

void SetSubY(uint16_t nSubY)

Sets the vertical pixel offset of this chart inside the cell.

uint16_t GetWidth()

Returns the width of the chart, in pixels.

void SetWidth(uint16_t nWidth)

Sets the width of the chart, in pixels.

uint16_t GetHeight()

Returns the height of the chart, in pixels.

void SetHeight(uint16_t nHeight)

Sets the height of the chart, in pixels.

Chart::Type GetType()

Returns the chart type.

Possible types are:

  • TYPE_COLUMN
  • TYPE_COLUMN_STACKED
  • TYPE_COLUMN_STACKED_100
  • TYPE_BAR
  • TYPE_BAR_STACKED
  • TYPE_BAR_STACKED_100
  • TYPE_LINE
  • TYPE_LINE_STACKED
  • TYPE_LINE_STACKED_100
  • TYPE_AREA
  • TYPE_AREA_STACKED
  • TYPE_AREA_STACKED_100

void SetType(Chart::Type eType)

Sets the chart type.

See Chart::GetType for the list of possible chart types.

Eg: pChart->SetType(Chart::TYPE_LINE);

uint16_t GetNumSeries()

Returns the number of Series contained in this chart.

Series* GetSeriesByIndex(uint16_t nIndex)

Returns a pointer to the Series from the given index.

Returns NULL if the given index is out of range.

Series* CreateSeries(const char* szValues)

Creates a new Series and returns a pointer to it.

szValues MUST be a 2D or 3D formula referencing the values for this series.

Eg: pChart->CreateSeries("=B2:G2");

Or: pChart->CreateSeries("=Sheet1!$B$2:$G$2");

void PurgeSeries(uint16_t nIndex)

Deletes the Series at the given index.

const char* GetCategories()

Returns a formula referencing the categories for this chart.

Categories are the things that go along the horizontal axis of your chart (or vertical if it's a bar chart).

The formula will either contain the most verbose 3D area possible (Eg: "=Sheet1!$A$1:$G$1"), or an empty formula (Eg: "=").

An empty formula will default the chart to dispaying 1,2,3... along the axis.

bool SetCategories(const char* szCategories)

Sets the categories used by this Chart.

szValues MUST be a formula containing a 2D or 3D area, or an empty formula.

Eg: pChart->SetCategories("=B1:G1");

Or: pChart->SetCategories("=Sheet1!$A$1:$G$1");

Or: pChart->SetCategories("=");

const char* GetTitle()

Returns a string containing the title of this Chart.

An empty string means that this Chart does not have a title.

void SetTitle(const char* szTitle)

Sets the title to be displayed on this Chart.

Pass in an empty string to remove the title.

const char* GetHorizontalAxisLabel()

void SetHorizontalAxisLabel(const char* szHorizontalAxisLabel)

const char* GetVerticalAxisLabel()

void SetVerticalAxisLabel(const char* szVerticalAxisLabel)

Legend* GetLegend()

Returns a pointer to the Legend for this Chart so you can change its appearence or hide it entirely.

Line* GetFrameBorderLine()

Returns a pointer to the Line for the border of the frame of this Chart.

The frame is the furthest edges of the chart.

Fill* GetFrameFill()

Returns a pointer to the Fill for the background of the frame of this Chart.

The frame is the furthest edges of the chart.

Line* GetPlotBorderLine()

Returns a pointer to the Line for the border of the plot area of this Chart.

The plot area is the rectangle inside the chart, bordered by the axis.

Fill* GetPlotFill()

Returns a pointer to the Fill for the background of the plot area of this Chart.

The plot area is the rectangle inside the chart, bordered by the axis.

Line* GetHorizontalAxisLine()

Returns a pointer to the Line of the horizontal axis of this Chart.

Line* GetHorizontalGridLine()

Returns a pointer to the Line of the horizontal grid lines of this Chart.

Line* GetVerticalAxisLine()

Returns a pointer to the Line of the vertical axis of this Chart.

Line* GetVerticalGridLine()

Returns a pointer to the Line of the vertical grid lines of this Chart.

Series

Represents a data series inside this Chart.

Use Chart::CreateSeries to create. Or use Chart::GetSeriesByIndex to get an existing Series.

const char* GetName()

Returns a formula containing the 3D address of a cell to use as the name of this Series.

bool SetName(const char* szName)

Sets the address of the cell containing the name of this Series.

Eg: pSeries->SetName("=Sheet1!A3");

const char* GetValues()

Returns a formula for the 3D area of cells containing the values to use for this Series.

bool SetValues(const char* szValues)

Sets the formula that references the cells containing the values for this series.

szValues can be a 2D or 3D formula.

Eg: pSeries->SetValues("=B2:G2");

Or: pSeries->SetValues("=Sheet1!$B$2:$G$2");

Line* GetLine()

Returns a pointer to the Line used by this Series.

Fill* GetFill()

Returns a pointer to the Fill used by this Series.

The fill is ignored for Line charts.

Marker* GetMarker()

Returns a pointer to the Marker used by this Series.

The marker style is only used for Line charts, it is ignored otherwise.

Legend

Represents the legend inside of a Chart.

Use Chart::GetLegend to get a pointer to it.

bool GetHidden() const

Returns true if this legend is not displayed.

void SetHidden(bool bHidden)

Used to show or hide the Legend.

Eg: pChart->GetLegend()->SetHidden(true);

Line* GetBorderLine()

Returns a pointer to the Line for the border of this Legend.

Fill* GetFill()

Returns a pointer to the Fill for the background of this Legend.

Font

Used in various places to style text.

const char* GetName()

Returns the name of the current font face used by this Font.

void SetName(const char* szName)

Sets the font face to be used by this Font.

Eg: pStyle->SetFont("Comic Sans MS");

uint8_t GetSize()

Returns the font size, in pixels, used by this Font.

void SetSize(uint8_t nSize)

Sets the font size of this Font, in pixels.

Eg: pStyle->SetSize(10);

const Color* GetColor()

Returns the current font color.

void SetColor(const Color color)

Sets the font color to be used by this Font.

Eg: pStyle->SetColor(NumberDuck::Color(0xFF, 0x00, 0xFF));

void ClearColor()

Clears the font color to be used by this Font back to the default.

The default is usually black, but may be different based on the users system settings when viewing the spreadsheet.

bool GetBold()

Returns the emboldment status for this Font.

void SetBold(bool bBold)

Used to set whether the font used by this Font is bold or not.

Eg: pStyle->SetBold(true);

bool GetItalic()

Returns true if the font used by this Font is italicized.

void SetItalic(bool bItalic)

Used to set whether the font used by this Font is italic or not.

Eg: pStyle->SetItalic(true);

Font::Underline GetUnderline()

Returns the type of underline used by this Font.

Possible types are:

  • UNDERLINE_NONE
  • UNDERLINE_SINGLE
  • UNDERLINE_DOUBLE
  • UNDERLINE_SINGLE_ACCOUNTING
  • UNDERLINE_DOUBLE_ACCOUNTING

void SetUnderline(Font::Underline eUnderline)

Sets the type of underline used by this Font.

See Style::GetUnderline for the list of possible underline types.

Eg: pStyle->SetUnderline(NumberDuck::Style::UNDERLINE_SINGLE);

Line

Lines are used to style different sections of Charts.

To disable a line, set the Type to Line::TYPE_NONE.

bool Equals(const Line* pLine) const

Returns true if this Line has the same appearence as pLine.

Eg: if (pSeriesA->GetLine()->Equals(pSeriesB->GetLine()))

Line::Type GetType() const

Returns the line type.

Possible types are:

  • TYPE_NONE
  • TYPE_THIN
  • TYPE_DASHED
  • TYPE_DOTTED
  • TYPE_DASH_DOT
  • TYPE_DASH_DOT_DOT
  • TYPE_MEDIUM
  • TYPE_MEDIUM_DASHED
  • TYPE_MEDIUM_DASH_DOT
  • TYPE_MEDIUM_DASH_DOT_DOT
  • TYPE_THICK

void SetType(Line::Type eType)

Sets the line type.

See Line::GetType for the list of possible types.

Eg: pLine->SetType(Chart::TYPE_DOTTED);

const Color* GetColor() const

Returns the current line color.

void SetColor(const Color color)

Sets the line color.

Eg: pLine->SetColor(NumberDuck::Color(0xFF, 0x00, 0xFF));

Fill

Used to modify the fill color of different sections of Charts.

To disable a fill, set the Type to Fill::TYPE_NONE.

bool Equals(const Fill* pFill) const

Returns true if this Fill has the same appearence as pFill.

Eg: if (pSeriesA->GetFill()->Equals(pSeriesB->GetFill()))

Fill::Type GetType() const

Returns the line type.

Possible types are:

  • TYPE_NONE
  • TYPE_SOLID

void SetType(Fill::Type eType)

Sets the fill type.

See Fill::GetType for the list of possible types.

Eg: pFill->SetType(Chart::TYPE_NONE);

const Color* GetForegroundColor() const

Returns the current foreground color.

This is the only color used for solid fills.

void SetForegroundColor(const Color foregroundColor)

Sets the foreground color.

Eg: pFill->SetForegroundColor(NumberDuck::Color(255, 128, 0));

const Color* GetBackgroundColor() const

Returns the current background color.

The background color is used in addition to the foreground color in pattern fills.

void SetBackgroundColor(const Color backgroundColor)

Sets the background color.

Eg: pFill->SetBackgroundColor(NumberDuck::Color(0, 0, 0));

Marker

Marker are used to style markers on Line Charts.

To disable a marker, set the Type to Marker::TYPE_NONE.

bool Equals(const Marker* pMarker) const

Returns true if this Marker has the same appearence as pMarker.

Eg: if (pSeriesA->GetMarker()->Equals(pSeriesB->GetMarker()))

Marker::Type GetType() const

Returns the marker type.

Possible types are:

  • TYPE_NONE
  • TYPE_SQUARE
  • TYPE_DIAMOND
  • TYPE_TRIANGLE
  • TYPE_X
  • TYPE_ASTERISK
  • TYPE_SHORT_BAR
  • TYPE_LONG_BAR
  • TYPE_CIRCULAR
  • TYPE_PLUS

void SetType(Marker::Type eType)

Sets the marker type.

See Marker::GetType for the list of possible types.

Eg: pMarker->SetType(Chart::TYPE_TRIANGLE);

const Color* GetFillColor() const

Returns the current fill color for the marker, or NULL for a transparent fill.

void SetFillColor(const Color fillColor)

Sets the fill color.

Eg: pMarker->SetFillColor(NumberDuck::Color(0xFF, 0x00, 0xFF));

void ClearFillColor()

Clears the fill color.

const Color* GetBorderColor() const

Returns the current border color for the marker, or NULL for no border.

void SetBorderColor(const Color borderColor)

Sets the border color.

Eg: pMarker->SetBorderColor(NumberDuck::Color(0xFF, 0x00, 0xFF));

void ClearBorderColor()

Clears the border color.

uint16_t GetSize() const

Returns the size of the marker, in pixels.

void SetSize(uint16_t nSize)

Sets the size of the marker, in pixels.

MergedCell

Allows you to modify merged cells that have been previously defined.

See Worksheet for functions to create and purge MergedCells

uint16_t GetX() const

Returns the X coordinate of the top left corner of the merged cells.

void SetX(uint16_t nX)

Sets the X coordinate of the top left corner of the merged cells.

uint16_t GetY() const

Returns the Y coordinate of the top left corner of the merged cells.

void SetY(uint16_t nY)

Sets the Y coordinate of the top left corner of the merged cells.

uint16_t GetWidth() const

Returns the width of the merged area, in cells.

void SetWidth(uint16_t nWidth)

Sets the width of the merged area, in cells.

uint16_t GetHeight() const

Returns the height of the merged area, in cells.

void SetHeight(uint16_t nHeight)

Sets the height of the merged area, in cells.