Skip to content

wxAutoExcel is a wxWidgets library attempting to make Microsoft Excel automation with C++ a bit less painful.

Notifications You must be signed in to change notification settings

PBfordev/wxAutoExcel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wxAutoExcel

GitHub MSVS 2022 GitHub MSYS2 GitHub Build docs

Introduction

wxAutoExcel is a wxWidgets (requires v3.1 or newer) C++ library attempting to make automating Microsoft Excel easier.

Platforms

Microsoft Windows, requires Microsoft Excel to be installed.

Installing and Using wxAutoExcel

See docs/install.md for instructions how to set-up and build wxAutoExcel and how to use it in your projects. I strongly suggest checking the tutorial and bundled samples to see the basics of wxAutoExcel in action. Documentation is available at https://pbfordev.github.io/wxAutoExcel/

Example of Code Using wxAutoExcel

The simple code below: (1) starts a new Microsoft Excel instance, adds a new workbook, (2) writes a string into the A1 cell of the first worksheet of the newly added workbook, (3) sets the text color of the A1 cell to blue, and (4) displays the window of the new Microsoft Excel instance.

#include <wx/wxAutoExcel.h>

using namespace wxAutoExcel;

// the following code is assumed to be inside 
// a function returning a bool

wxExcelApplication app = wxExcelApplication::CreateInstance();
if ( !app )
{
    wxLogError(_("Could not launch Microsoft Excel. Please check that it is properly installed."));
    return false;
}

app.SetVisible(true);

wxExcelWorkbook workbook = app.GetWorkbooks().Add();
if ( !workbook )
{
    wxLogError(_("Failed to create a new workbook."));
    return false;
}

wxExcelRange range = workbook.GetWorksheets()[1].GetRange("A1");
range = "Hello, World!";
range.GetFont().SetColor(*wxBLUE);

Licence

wxWidgets licence

About

wxAutoExcel is a wxWidgets library attempting to make Microsoft Excel automation with C++ a bit less painful.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages