Documentation Buy Contact Blog
C++ API Reference
Workbook

Provides read/write access to Excel .xls files.

Workbook()
~Workbook()
void Clear()
bool Load(const char* szFileName)
bool Save(const char* szFileName, Workbook::FileType eFileType)
unsigned int GetNumWorksheet()
Worksheet* GetWorksheetByIndex(unsigned int nIndex)
Worksheet* CreateWorksheet()
void PurgeWorksheet(unsigned int nIndex)
unsigned int GetNumStyle()
Style* GetStyleByIndex(unsigned int 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)
bool GetShowGridlines()
void SetShowGridlines(bool bShowGridlines)
bool GetPrintGridlines()
void SetPrintGridlines(bool bPrintGridlines)
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)
int GetNumPicture()
Picture* GetPictureByIndex(int nIndex)
Picture* CreatePicture(const char* szFileName)
void PurgePicture(int nIndex)
int GetNumChart()
Chart* GetChartByIndex(int nIndex)
Chart* CreateChart(Chart::Type eType)
void PurgeChart(int nIndex)
int GetNumMergedCell()
MergedCell* GetMergedCellByIndex(int nIndex)
MergedCell* CreateMergedCell(uint16_t nX, uint16_t nY, uint16_t nWidth, uint16_t nHeight)
void PurgeMergedCell(int nIndex)


Cell

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

bool Equals(const 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.

~Value()
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(Style::VerticalAlign eVerticalAlign)
Color* GetBackgroundColor(bool bCreateIfMissing)
void ClearBackgroundColor()
Style::FillPattern GetFillPattern()
void SetFillPattern(Style::FillPattern eFillPattern)
Color* GetFillPatternColor(bool bCreateIfMissing)
void ClearFillPatternColor()
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(unsigned char nRed, unsigned char nGreen, unsigned char nBlue)
~Color()
bool Equals(const Color* pColor) const
void Set(unsigned char nRed, unsigned char nGreen, unsigned char nBlue)
void SetFromRgba(unsigned int nRgba)
void SetFromColor(const Color* pColor)
unsigned char GetRed() const
void SetRed(unsigned char nRed)
unsigned char GetGreen() const
void SetGreen(unsigned char nGreen)
unsigned char GetBlue() const
void SetBlue(unsigned char nBlue)
unsigned int GetRgba() const


Picture

Represents an embedded picture inside a worksheet.

unsigned int GetX()
bool SetX(unsigned int nX)
unsigned int GetY()
bool SetY(unsigned int nY)
unsigned int GetSubX()
void SetSubX(unsigned int nSubX)
unsigned int GetSubY()
void SetSubY(unsigned int nSubY)
unsigned int GetWidth()
void SetWidth(unsigned int nWidth)
unsigned int GetHeight()
void SetHeight(unsigned int nHeight)
const char* GetUrl()
void SetUrl(const char* szUrl)
Blob* GetBlob()
Picture::Format GetFormat()


Chart

Represents an embedded chart inside a worksheet.

unsigned int GetX()
bool SetX(unsigned int nX)
unsigned int GetY()
bool SetY(unsigned int nY)
unsigned int GetSubX()
void SetSubX(unsigned int nSubX)
unsigned int GetSubY()
void SetSubY(unsigned int nSubY)
unsigned int GetWidth()
void SetWidth(unsigned int nWidth)
unsigned int GetHeight()
void SetHeight(unsigned int nHeight)
Chart::Type GetType()
void SetType(Chart::Type eType)
unsigned int GetNumSeries()
Series* GetSeriesByIndex(unsigned int nIndex)
Series* CreateSeries(const char* szValues)
void PurgeSeries(unsigned int 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)
unsigned char GetSize()
void SetSize(unsigned char nSize)
Color* GetColor(bool bCreateIfMissing)
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)
Color* GetColor()


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)
Color* GetForegroundColor()
Color* GetBackgroundColor()


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)
Color* GetFillColor(bool bCreateIfMissing)
void SetFillColor(const Color* pColor)
void ClearFillColor()
Color* GetBorderColor(bool bCreateIfMissing)
void SetBorderColor(const Color* pColor)
void ClearBorderColor()
int GetSize() const
void SetSize(int nSize)


MergedCell

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

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


Workbook

Provides read/write access to Excel .xls files.

Workbook()

Unassuming constructor.

~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, Workbook::FileType eFileType)

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

Possible file types are:

  • Workbook::TYPE_XLS
  • Workbook::TYPE_XLSX

Returns false on error.

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

unsigned int 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.

unsigned int GetNumStyle()

Returns the number of existing Styles available in this Workbook.

More styles may be created with the CreateStyle function.

Style* GetStyleByIndex(unsigned int 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.

bool GetShowGridlines()

Returns true if grid lines are shown.

void SetShowGridlines(bool bShowGridlines)

Sets if grid lines will be shown.

bool GetPrintGridlines()

Returns true if grid lines are printed.

void SetPrintGridlines(bool bPrintGridlines)

Sets if grid lines will be printed.

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");

int GetNumPicture()

Returns the number of pictures embedded in this worksheet.

Picture* GetPictureByIndex(int 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(int nIndex)

Deletes the Picture at the given index.

int GetNumChart()

Returns the number of charts embedded in this worksheet.

Chart* GetChartByIndex(int 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(int nIndex)

Deletes the Chart at the given index.

int GetNumMergedCell()

Returns the number of merged cells in this worksheet.

MergedCell* GetMergedCellByIndex(int 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(int 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 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.

~Value()

HAX!!! destructor.

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(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(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(Style::VERTICAL_ALIGN_CENTER);

Color* GetBackgroundColor(bool bCreateIfMissing)

Returns the background color.

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.

Style::FillPattern GetFillPattern()

Returns the fill pattern used for the background of this Style.

Fill patterns are laid on top of the background color.

Possible types are:

  • FILL_PATTERN_NONE
  • FILL_PATTERN_50
  • FILL_PATTERN_75
  • FILL_PATTERN_25
  • FILL_PATTERN_125
  • FILL_PATTERN_625
  • FILL_PATTERN_HORIZONTAL_STRIPE
  • FILL_PATTERN_VARTICAL_STRIPE
  • FILL_PATTERN_DIAGONAL_STRIPE
  • FILL_PATTERN_REVERSE_DIAGONAL_STRIPE
  • FILL_PATTERN_DIAGONAL_CROSSHATCH
  • FILL_PATTERN_THICK_DIAGONAL_CROSSHATCH
  • FILL_PATTERN_THIN_HORIZONTAL_STRIPE
  • FILL_PATTERN_THIN_VERTICAL_STRIPE
  • FILL_PATTERN_THIN_REVERSE_VERTICAL_STRIPE
  • FILL_PATTERN_THIN_DIAGONAL_STRIPE
  • FILL_PATTERN_THIN_HORIZONTAL_CROSSHATCH
  • FILL_PATTERN_THIN_DIAGONAL_CROSSHATCH

void SetFillPattern(Style::FillPattern eFillPattern)

Sets the fill pattern used for the background of this Style.

See Style::GetFillPattern for the list of possible fill patterns.

Eg: pStyle->SetFillPattewrn(Style::FILL_PATTERN_50);

Color* GetFillPatternColor(bool bCreateIfMissing)

Returns the fill pattern color.

void ClearFillPatternColor()

Clears the fill pattern color.

Like the background color, When the fill pattern color is cleared, it will be chosen from the users system settings, which is most likely black.

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(unsigned char nRed, unsigned char nGreen, unsigned char nBlue)

Constructor.

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

~Color()

Resolute destructor.

bool Equals(const Color* pColor) const

Returns true if this Color matches the one given.

void Set(unsigned char nRed, unsigned char nGreen, unsigned char nBlue)

Sets all components of this Color at once.

Eg: pColor->Set(0xBE, 0xEE, 0xFF);

void SetFromRgba(unsigned int nRgba)

Similar to Set, sets all components of this Color at once.

Eg: pColor->SetFromRgba(0xBEEEFF);

void SetFromColor(const Color* pColor)

Sets all components of this Color, from the components of another Color.

Eg: pColor->SetFromColor(pOtherColor);

unsigned char GetRed() const

Returns the red value of this color.

void SetRed(unsigned char nRed)

Sets the red value of this color.

unsigned char GetGreen() const

Returns the green value of this color.

void SetGreen(unsigned char nGreen)

Sets the red value of this color.

unsigned char GetBlue() const

Returns the blue value of this color.

void SetBlue(unsigned char nBlue)

Sets the blue value of this color.

unsigned int 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.

unsigned int GetX()

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

bool SetX(unsigned int nX)

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

Returns false if an out of bounds column is given.

unsigned int GetY()

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

bool SetY(unsigned int nY)

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

Returns false if an out of bounds row is given.

unsigned int GetSubX()

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

void SetSubX(unsigned int nSubX)

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

unsigned int GetSubY()

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

void SetSubY(unsigned int nSubY)

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

unsigned int GetWidth()

Returns the width of the pitcure, in pixels.

void SetWidth(unsigned int nWidth)

Sets the width of the picture, in pixels.

unsigned int GetHeight()

Returns the height of the pitcure, in pixels.

void SetHeight(unsigned int 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.

Blob* GetBlob()

Returns the binary data for this image.

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

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.

unsigned int GetX()

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

bool SetX(unsigned int nX)

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

Returns false if an out of bounds column is given.

unsigned int GetY()

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

bool SetY(unsigned int nY)

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

Returns false if an out of bounds row is given.

unsigned int GetSubX()

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

void SetSubX(unsigned int nSubX)

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

unsigned int GetSubY()

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

void SetSubY(unsigned int nSubY)

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

unsigned int GetWidth()

Returns the width of the chart, in pixels.

void SetWidth(unsigned int nWidth)

Sets the width of the chart, in pixels.

unsigned int GetHeight()

Returns the height of the chart, in pixels.

void SetHeight(unsigned int 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);

unsigned int GetNumSeries()

Returns the number of Series contained in this chart.

Series* GetSeriesByIndex(unsigned int 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(unsigned int 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");

unsigned char GetSize()

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

void SetSize(unsigned char nSize)

Sets the font size of this Font, in pixels.

Eg: pStyle->SetSize(10);

Color* GetColor(bool bCreateIfMissing)

Returns the current font color.

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(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);

Color* GetColor()

Returns the current line color.

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);

Color* GetForegroundColor()

Returns the current foreground color.

This is the only color used for solid fills.

Color* GetBackgroundColor()

Returns the current background color.

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

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);

Color* GetFillColor(bool bCreateIfMissing)

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

void SetFillColor(const Color* pColor)

Sets the fill color.

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

void ClearFillColor()

Clears the fill color.

Color* GetBorderColor(bool bCreateIfMissing)

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

void SetBorderColor(const Color* pColor)

Sets the border color.

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

void ClearBorderColor()

Clears the border color.

int GetSize() const

Returns the size of the marker, in pixels.

void SetSize(int 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

unsigned int GetX() const

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

void SetX(unsigned int nX)

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

unsigned int GetY() const

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

void SetY(unsigned int nY)

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

unsigned int GetWidth() const

Returns the width of the merged area, in cells.

void SetWidth(unsigned int nWidth)

Sets the width of the merged area, in cells.

unsigned int GetHeight() const

Returns the height of the merged area, in cells.

void SetHeight(unsigned int nHeight)

Sets the height of the merged area, in cells.