Provides read/write access to Excel .xls files.
Workbook()Provides access to cells and other stuff of a worksheet.
const char* GetName()Cell objects give access to the properties of a single cell.
bool Equals(const Cell* pCell) constA Value is an object that can contain different types of values.
~Value()Used for styling cells.
Font* GetFont()RGB color information. Used by the Style class.
Color(unsigned char nRed, unsigned char nGreen, unsigned char nBlue)Represents an embedded picture inside a worksheet.
unsigned int GetX()Represents an embedded chart inside a worksheet.
unsigned int GetX()Represents a data series inside this Chart.
const char* GetName()Represents the legend inside of a Chart.
bool GetHidden() constUsed in various places to style text.
const char* GetName()Lines are used to style different sections of Charts.
bool Equals(const Line* pLine) constUsed to modify the fill color of different sections of Charts.
bool Equals(const Fill* pFill) constMarker are used to style markers on Line Charts.
bool Equals(const Marker* pMarker) constAllows you to modify merged cells that have been previously defined.
unsigned int GetX() constProvides read/write access to Excel .xls files.
Unassuming constructor.
Resolute destructor.
Clears this workbook back to defaults. The same result as deleting the object and constructing it again.
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.
Saves the current workbook to disk in Excel .xls format.
Possible file types are:
Returns false on error.
Eg: pWorkbook->Save("BananaReport.xls");
Returns the number of worksheets available.
Returns a pointer to the Worksheet from the given index.
Returns NULL if the given index is out of range.
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.
Deletes the Worksheet at the given index.
Returns the number of existing Styles available in this Workbook.
More styles may be created with the CreateStyle function.
Returns the Style at the given index.
Returns NULL if you give an out of range index like a silly person.
Returns the default Style for this Workbook.
This is a simple wrapper for GetStyleByIndex(0).
Creates a new Style and returns a pointer to it.
Using this pointer you can set all the pretties for a Cell.
Provides access to cells and other stuff of a worksheet.
Returns the name of the worksheet in UTF8.
Sets the name of the worksheet. Returns false if the name is already in use by another Worksheet.
szName is a UTF8 string.
Returns the orientation of the worksheet for printing.
Possible orientations are:
Sets the page orientation for printing.
See Worksheet::SetOrientation for a list of possible orientations.
Returns true if grid lines are shown.
Sets if grid lines will be shown.
Returns true if grid lines are printed.
Sets if grid lines will be printed.
Returns the width of the given column in pixels.
Sets the width of the column in pixels.
Returns true if the given column is hidden.
Allows you to show or hide the given column.
Inserts a column before the given one.
The 255th column is removed to make room for it.
Deletes the given column.
Returns the height of the given row in pixels.
Sets the pixel height of the given row of the worksheet.
Inserts a row before the given one.
The 65535th row is removed to make room for it.
Deletes the given row.
Returns the Cell at the address given.
Eg: pWorksheet->GetCell("B5");
Returns the Cell at the zero based coordinates given.
Eg: pWorkSheet->GetCell(1, 4); // same as pWorksheet->GetCell("B5");
Returns the Cell at the RC coordinates given.
Eg: pWorkSheet->GetCell(1, 1); // same as pWorksheet->GetCell("A1");
Returns the number of pictures embedded in this worksheet.
Returns a pointer to the Picture from the given index.
Returns NULL if the given index is out of range.
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.
Deletes the Picture at the given index.
Returns the number of charts embedded in this worksheet.
Returns a pointer to the Chart from the given index.
Returns NULL if the given index is out of range.
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);
Deletes the Chart at the given index.
Returns the number of merged cells in this worksheet.
Returns a pointer to the MergedCell from the given index.
Returns NULL if the given index is out of range.
Creates a new MergedCell and returns a pointer to it.
Returns NULL if the given coordinates are out of range.
Deletes the MergedCell at the given index, unmerging the cells.
Cell objects give access to the properties of a single cell. This is all pretty straightforward right?
Comparison function, returns true if this cell matches the one given.
Eg: If both cells contain the same number.
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.
Returns the type of the contents of this cell.
Possible types are:
Clears this cell back to a pristine untouched state.
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.
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.
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.
Returns the float stored in this cell.
If the cell type is not TYPEFLOAT this function will return 0.0. Use _GetType to check.
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.
Returns the boolean stored in this cell.
If the cell type is not TYPEBOOLEAN this function will return false. Use _GetType to check.
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)");
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.
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.
Gets the current Style applied to this cell.
Compare against Workbook::GetDefaultStyle to see if this cell is using default styling.
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.
A Value is an object that can contain different types of values.
HAX!!! destructor.
Comparison function, returns true if this value matches the one given.
Returns the type of the contents of this cell.
Possible types are:
If this Value is the result of a formula evaluation, it may also be: TYPE_ERROR.
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.
Returns the float stored in this Value.
If the Value type is not TYPEFLOAT this function will return 0.0. Use _GetType to check.
Returns the boolean stored in this Value.
If the Value type is not TYPEBOOLEAN this function will return false. Use _GetType to check.
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.
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.
Used for styling cells.
Use Workbook::CreateStyle to create a new style.
Or use Cell::GetStyle or Workbook::GetStyleByIndex to use an existing Style.
Returns a pointer to a Font for changing font pretties.
Returns horizontal alignment of text for this Style.
Possible types are:
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);
Returns vertical alignment of text for this Style.
Possible types are:
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);
Returns the background color.
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.
Returns the fill pattern used for the background of this Style.
Fill patterns are laid on top of the background color.
Possible types are:
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);
Returns the fill pattern color.
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.
Returns the Line for the top border.
Returns the Line for the right border.
Returns the Line for the bottom border.
Returns the Line for the left border.
Returns the formattig for this _Style, which controls how Excel displays numbers and text.
Todo: moar info
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");
RGB color information. Used by the Style class.
Constructor.
Eg: pStyle->SetColor(Color(0x00, 0xFF, 0x00));
Resolute destructor.
Returns true if this Color matches the one given.
Sets all components of this Color at once.
Eg: pColor->Set(0xBE, 0xEE, 0xFF);
Similar to Set, sets all components of this Color at once.
Eg: pColor->SetFromRgba(0xBEEEFF);
Sets all components of this Color, from the components of another Color.
Eg: pColor->SetFromColor(pOtherColor);
Returns the red value of this color.
Sets the red value of this color.
Returns the green value of this color.
Sets the red value of this color.
Returns the blue value of this color.
Sets the blue value of this color.
Returns the this color as a 32bit RGBA int.
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.
Returns the column where the top left corner of the picture is anchored.
Sets the column where top left corner of the picture is anchored.
Returns false if an out of bounds column is given.
Returns the row where the top left corner of the picture is anchored.
Sets the row where top left corner of the picture is anchored.
Returns false if an out of bounds row is given.
Returns the horizontal pixel offset of the picture within the cell given by GetX() and GetY().
Sets the horizontal pixel offset of this picture inside the cell.
Returns the vertical pixel offset of the picture within the cell given by GetX() and GetY().
Sets the vertical pixel offset of this picture inside the cell.
Returns the width of the pitcure, in pixels.
Sets the width of the picture, in pixels.
Returns the height of the pitcure, in pixels.
Sets the height of the picture, in pixels.
Returns the url linked to from this picture, or an empty string if there is no link.
Sets the url this picture is linked to. Pass an empty string to not link to anything.
Returns the binary data for this image.
See GetFormat() for what image format this data is in.
Returns the image format of the data given by GetData().
Possible types are:
Represents an embedded chart inside a worksheet.
Use Workbook::CreateChart to create. Or use Workbook::GetChartByIndex to get an existing chart.
Returns the column where the top left corner of the chart is anchored.
Sets the column where top left corner of the chart is anchored.
Returns false if an out of bounds column is given.
Returns the row where the top left corner of the chart is anchored.
Sets the row where top left corner of the chart is anchored.
Returns false if an out of bounds row is given.
Returns the horizontal pixel offset of the chart within the cell given by GetX() and GetY().
Sets the horizontal pixel offset of this chart inside the cell.
Returns the vertical pixel offset of the chart within the cell given by GetX() and GetY().
Sets the vertical pixel offset of this chart inside the cell.
Returns the width of the chart, in pixels.
Sets the width of the chart, in pixels.
Returns the height of the chart, in pixels.
Sets the height of the chart, in pixels.
Returns the chart type.
Possible types are:
Sets the chart type.
See Chart::GetType for the list of possible chart types.
Eg: pChart->SetType(Chart::TYPE_LINE);
Returns the number of Series contained in this chart.
Returns a pointer to the Series from the given index.
Returns NULL if the given index is out of range.
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");
Deletes the Series at the given index.
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.
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("=");
Returns a string containing the title of this Chart.
An empty string means that this Chart does not have a title.
Sets the title to be displayed on this Chart.
Pass in an empty string to remove the title.
Returns a pointer to the Legend for this Chart so you can change its appearence or hide it entirely.
Returns a pointer to the Line for the border of the frame of this Chart.
The frame is the furthest edges of the chart.
Returns a pointer to the Fill for the background of the frame of this Chart.
The frame is the furthest edges of the chart.
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.
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.
Returns a pointer to the Line of the horizontal axis of this Chart.
Returns a pointer to the Line of the horizontal grid lines of this Chart.
Returns a pointer to the Line of the vertical axis of this Chart.
Returns a pointer to the Line of the vertical grid lines of this Chart.
Represents a data series inside this Chart.
Use Chart::CreateSeries to create. Or use Chart::GetSeriesByIndex to get an existing Series.
Returns a formula containing the 3D address of a cell to use as the name of this Series.
Sets the address of the cell containing the name of this Series.
Eg: pSeries->SetName("=Sheet1!A3");
Returns a formula for the 3D area of cells containing the values to use for this Series.
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");
Returns a pointer to the Line used by this Series.
Returns a pointer to the Fill used by this Series.
The fill is ignored for Line charts.
Returns a pointer to the Marker used by this Series.
The marker style is only used for Line charts, it is ignored otherwise.
Represents the legend inside of a Chart.
Use Chart::GetLegend to get a pointer to it.
Returns true if this legend is not displayed.
Used to show or hide the Legend.
Eg: pChart->GetLegend()->SetHidden(true);
Returns a pointer to the Line for the border of this Legend.
Returns a pointer to the Fill for the background of this Legend.
Used in various places to style text.
Returns the name of the current font face used by this Font.
Sets the font face to be used by this Font.
Eg: pStyle->SetFont("Comic Sans MS");
Returns the font size, in pixels, used by this Font.
Sets the font size of this Font, in pixels.
Eg: pStyle->SetSize(10);
Returns the current font color.
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.
Returns the emboldment status for this Font.
Used to set whether the font used by this Font is bold or not.
Eg: pStyle->SetBold(true);
Returns true if the font used by this Font is italicized.
Used to set whether the font used by this Font is italic or not.
Eg: pStyle->SetItalic(true);
Returns the type of underline used by this Font.
Possible types are:
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);
Lines are used to style different sections of Charts.
To disable a line, set the Type to Line::TYPE_NONE.
Returns true if this Line has the same appearence as pLine.
Eg: if (pSeriesA->GetLine()->Equals(pSeriesB->GetLine()))
Returns the line type.
Possible types are:
Sets the line type.
See Line::GetType for the list of possible types.
Eg: pLine->SetType(Chart::TYPE_DOTTED);
Returns the current line color.
Used to modify the fill color of different sections of Charts.
To disable a fill, set the Type to Fill::TYPE_NONE.
Returns true if this Fill has the same appearence as pFill.
Eg: if (pSeriesA->GetFill()->Equals(pSeriesB->GetFill()))
Returns the line type.
Possible types are:
Sets the fill type.
See Fill::GetType for the list of possible types.
Eg: pFill->SetType(Chart::TYPE_NONE);
Returns the current foreground color.
This is the only color used for solid fills.
Returns the current background color.
The background color is used in addition to the foreground color in pattern fills.
Marker are used to style markers on Line Charts.
To disable a marker, set the Type to Marker::TYPE_NONE.
Returns true if this Marker has the same appearence as pMarker.
Eg: if (pSeriesA->GetMarker()->Equals(pSeriesB->GetMarker()))
Returns the marker type.
Possible types are:
Sets the marker type.
See Marker::GetType for the list of possible types.
Eg: pMarker->SetType(Chart::TYPE_TRIANGLE);
Returns the current fill color for the marker, or NULL for a transparent fill.
Sets the fill color.
Eg: Color color(0xFF, 0x00, 0xFF); pMarker->SetFillColor(&color);
Clears the fill color.
Returns the current border color for the marker, or NULL for no border.
Sets the border color.
Eg: Color color(0xFF, 0x00, 0xFF); pMarker->SetBorderColor(&color);
Clears the border color.
Returns the size of the marker, in pixels.
Sets the size of the marker, in pixels.
Allows you to modify merged cells that have been previously defined.
See Worksheet for functions to create and purge MergedCells
Returns the X coordinate of the top left corner of the merged cells.
Sets the X coordinate of the top left corner of the merged cells.
Returns the Y coordinate of the top left corner of the merged cells.
Sets the Y coordinate of the top left corner of the merged cells.
Returns the width of the merged area, in cells.
Sets the width of the merged area, in cells.
Returns the height of the merged area, in cells.
Sets the height of the merged area, in cells.