|
@@ -0,0 +1,67 @@
|
|
|
+#include "ivxlnt.h"
|
|
|
+
|
|
|
+#include "xlnt/xlnt.hpp"
|
|
|
+
|
|
|
+class Ivxlnt_Impl
|
|
|
+{
|
|
|
+
|
|
|
+public:
|
|
|
+ Ivxlnt_Impl(std::string strfilepath)
|
|
|
+ {
|
|
|
+ mwb.load(strfilepath);
|
|
|
+ mws = mwb.active_sheet();
|
|
|
+ }
|
|
|
+ std::string getcellvalue(unsigned int column,unsigned int row)
|
|
|
+ {
|
|
|
+ return mws.cell(xlnt::cell_reference(column,row)).to_string();
|
|
|
+ }
|
|
|
+private:
|
|
|
+ xlnt::workbook mwb;
|
|
|
+ xlnt::worksheet mws ;
|
|
|
+};
|
|
|
+
|
|
|
+class Ivxlnt
|
|
|
+{
|
|
|
+public:
|
|
|
+ Ivxlnt(std::string strfilepath);
|
|
|
+ ~Ivxlnt();
|
|
|
+ std::string getcellvalue(unsigned int column,unsigned int row);
|
|
|
+private:
|
|
|
+ void * mpimpl;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+Ivxlnt::Ivxlnt(std::string strfilepath)
|
|
|
+{
|
|
|
+ mpimpl = new Ivxlnt_Impl(strfilepath);
|
|
|
+}
|
|
|
+
|
|
|
+std::string Ivxlnt::getcellvalue(unsigned int column,unsigned int row)
|
|
|
+{
|
|
|
+ Ivxlnt_Impl * p = (Ivxlnt_Impl * )mpimpl;
|
|
|
+ return p->getcellvalue(column,row);
|
|
|
+}
|
|
|
+
|
|
|
+Ivxlnt::~Ivxlnt()
|
|
|
+{
|
|
|
+ Ivxlnt_Impl * p = (Ivxlnt_Impl * )mpimpl;
|
|
|
+ delete p;
|
|
|
+}
|
|
|
+
|
|
|
+void * Openxlsx(std::string strfilepath)
|
|
|
+{
|
|
|
+ void * p = new Ivxlnt(strfilepath);
|
|
|
+ return p;
|
|
|
+}
|
|
|
+
|
|
|
+std::string getcellvalue(void * pxlsxhanle,unsigned int column,unsigned int row)
|
|
|
+{
|
|
|
+ Ivxlnt * p = (Ivxlnt * )pxlsxhanle;
|
|
|
+ return p->getcellvalue(column,row);
|
|
|
+}
|
|
|
+
|
|
|
+void Closexlsx(void * pxlsxhanle)
|
|
|
+{
|
|
|
+ Ivxlnt * p = (Ivxlnt * )pxlsxhanle;
|
|
|
+ delete p;
|
|
|
+}
|