Follow the steps to create a project, If You need to compile the wxAutoExcel static libraries, follow these steps from here viewtopic.php?f=29&t=49419
Creating a project
01 - Create an empty project.
02 - Create cApp class files
cApp.h
Code: Select all
#pragma once
#pragma comment( lib, "wxAutoExcel20.lib" )
#include "wx/wx.h"
#include "wx/wxAutoExcel.h"
class cApp : public wxApp
{
public:
cApp() = default;
~cApp() = default;
virtual bool OnInit();
};
Code: Select all
#include "cApp.h"
using namespace wxAutoExcel;
wxIMPLEMENT_APP(cApp);
bool cApp::OnInit()
{
wxExcelApplication app = wxExcelApplication::CreateInstance();
if (!app)
{
wxLogError(_("Could not launch Microsoft Excel. Please check that it is properly installed."));
}
wxExcelWorkbook workbook = app.GetWorkbooks().Add();
if (!workbook)
{
wxLogError(_("Failed to create a new workbook."));
}
wxExcelRange range = workbook.GetWorksheets()[1].GetRange("A1");
range = "Hello, World!";
range.GetFont().SetColor(*wxBLUE);
app.SetVisible(true);
return true;
}
Make sure the SubSystem configuration is configured as SUBSYSTEM:WINDOWS for all configuration types.
04 - Add library path to include directory list
Add this wxAutoExcel library path to the directory list - $(WXWIN)\include;$(WXWIN)\include\msvc;$(WXEXCEL)\include
in the example above the WXWIN environment variable is related to the wxWidgets path.
05 - Add library path for each Configuration x Platform type.
- x64 - $(WXWIN)\lib\vc_x64_lib;$(WXEXCEL)\out\build\x64\lib
- x64 Debug - $(WXWIN)\lib\vc_x64_lib;$(WXEXCEL)\out\build\x64-Debug\lib
- x86 - $(WXWIN)\lib\vc_lib;$(WXEXCEL)\out\build\x86\lib
- x86 Debug - $(WXWIN)\lib\vc_lib;$(WXEXCEL)\out\build\x86-Debug\lib
Hope that helps!