Closed liufeijin closed 5 years ago
Dear, @liufeijin
To build HelloQxlnt on Windows, you need to build two projects. One is \Qxlnt\Qxlnt\Qxlnt.pro, the other is '\Qxlnt\HelloQXlnt\HelloQXlnt.pro'
:one: First, Build Qxlnt(.dll & .lib) Using 'QT VS Tools'
:two: Second, Build HelloXnlt Using 'QT VS Tools'. The build step is the same as above.
ℹ️ I built it in the following environment.
- Microsoft Windows 10 64bit
- Visual Studio 2017 64bit
- Qt 5.12.0 (VS2017/x64)
- Qt Visual Studio Tools 2.2.2
❕ If it does not build again, I need more accurate log information.
VS2017 Qtcreator4.8
The first step is ok get the lib.
The Second is fail.
main.obj:-1: error: LNK2019: 无法解析的外部符号 "declspec(dllimport) public: void cdecl xlnt::cell::value(int)" (imp_?value@cell@xlnt@@QEAAXH@Z),该符号在函数 main 中被引用
main.obj:-1: error: LNK2019: 无法解析的外部符号 "declspec(dllimport) public: void cdecl xlnt::cell::value(char const *)" (_imp?value@cell@xlnt@@QEAAXPEBD@Z),该符号在函数 main 中被引用
main.obj:-1: error: LNK2019: 无法解析的外部符号 "declspec(dllimport) public: void cdecl xlnt::workbook::save(class std::basic_string<char,struct std::char_traits
suggest you to make a clear and simple include struct , like my QXlsx as below, anybody only need include the QXlsx.pri in his pro file of project. https://github.com/liufeijin/QXlsx/blob/master/21225.png
Hi, Thanks for reporting.
:one: If you are using Visual C++, xlnt is compiled as a DLL. The setting of Qxlnt reflects the DLL compilation. So it need more complicated settings than QXlsx.
:two: Use Visual Studio 2017 and Qt 5.9.1 or higher version. Qt 4 is not supported for C++14. xlnt uses C ++ 14. To use C ++ 14, use Visual Studio 2017.
For more Qt and Visual Studio version information, please see the link.
I used QT5.12.0 Visual studio 2017 build in qtcreator. failed. I think maybe the patch of QXInt problem
Hi, Thanks for reporting.
1️⃣ If you are using Visual C++, xlnt is compiled as a DLL. The setting of Qxlnt reflects the DLL compilation. So it need more complicated settings than QXlsx.
2️⃣ Use Visual Studio 2017 and Qt 5.9.1 or higher version. Qt 4 is not supported for C++14. xlnt uses C ++ 14. To use C ++ 14, use Visual Studio 2017.
For more Qt and Visual Studio version information, please see the link.
- Qt 5.9.1 and later versions are pre-built for VS 2017 64 bits.
- Qt 5.12.0 (LTS) comes with precompiled binaries for VS 2017 32 and 64 bits.
I found where is the problem that build helloQXlnt need the Qxlnt.lib ( this lib is not the static lib ) So i rebuild QxLnt and got Qxlnt.dll and QxLnt.lib . copy to release folder and then ok
Generate a new excel file is ok,but don't know how to open a exit excel file modify and save. QString filess="d:/1.xlsx"; wb.load(filess.toStdString()); xlnt::worksheet ws = wb.sheet_by_index(5); // wb.active_sheet(); ws.cell("A1").value(5); ws.cell("B2").value("string data"); ws.cell("C3").formula("=RAND()"); ws.merge_cells("C3:C4"); ws.freeze_panes("B2"); wb.save("d:/1.xlsx"); // wb.save() can't use. above code can't reach the target.
Congratulations on your success build.
Of course, _.lib is not a static lib. It is a lib for shared DLL.
To use xlnt, see xlnt document. There are descriptions and examples.
Many thanks for your explain. I checked the address , there are 3 simple . 1 generate a new excel file(i follow and ok) 1 is read a excel and qdebug out. I rewrite the excel file generated by the simple code 1 , it is ok . Can write , but has erroe also when i open the modified excel by office. So i think i to be gave up QXlnt as it can't read the complex excel file.(error) So only 1 way for us , it is QXlsx if you can repair the shared formula problem.
The error is :-1: error: LNK1181: can't open input file “..\Qxlnt\release\QXlnt.lib” If build QXlint.lib and put release folder , a lot of error about static lib and dll . Seems too many level for include pri file. Best regards, jeff