JanKallman / EPPlus

Create advanced Excel spreadsheets using .NET
3.75k stars 1.17k forks source link

C++ compiler error caused by internal CellStore class #29

Open davidgeewhiz opened 6 years ago

davidgeewhiz commented 6 years ago

I am testing the pre-release 4.1.1.0 dll in a C++ project and am getting the build error below (worked fine with 4.1.0.0)

1>c:\path...\epplus.dll : error C3252: 'CellStore::Finalize' : cannot reduce accessibility of a virtual method in a managed type 1> This diagnostic occurred while importing type 'CellStore ' from assembly 'EPPlus, Version=4.1.1.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1'. 1> This diagnostic occurred while importing type 'OfficeOpenXml::ExcelWorksheet ' from assembly 'EPPlus, Version=4.1.1.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1'. 1>....\excel.cpp(265): error C3252: 'CellStore::Finalize' : cannot reduce accessibility of a virtual method in a managed type 1> with 1> [ 1> T=OfficeOpenXml::ExcelCoreValue 1> ] 1> ....\excel.cpp(265) : see reference to class generic instantiation 'CellStore' being compiled 1> with 1> [ 1> T=OfficeOpenXml::ExcelCoreValue 1> ] 1> This diagnostic occurred while importing type 'OfficeOpenXml::ExcelWorksheet ' from assembly 'EPPlus, Version=4.1.1.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1'.

The line in question is testing a reference to ExcelWorksheet with nullptr:

bool CreateWorksheet (ExcelWorksheet^ %ws) { if (ws != nullptr) { <---- Error C3252 do stuff to ws... } }

The error goes away if CellStore class is changed from internal to public. I hope this can get into next release, or whatever remaining C++ folks out there will be vexed!

okattelus commented 6 years ago

Hi

For some reason we are getting this same error with the currently newest version 4.5.2.1.

It's being generated by following line of code:

ExcelComment ^comment = m_workSheet->Cells[1,columnindex]->AddComment(param->guid,"GUID");

Is this library or compiler bug?