QtXlsxWriter icon indicating copy to clipboard operation
QtXlsxWriter copied to clipboard

Getting Error when added the file to 3rd party

Open anilsharma152 opened this issue 9 years ago • 3 comments

Hello I want to use the src file for the 3rd party .I am working on windows with Qt 5.1.0. I added all the source and header file to my project and added DEFINES += XLSX_NO_LIB to .pro file but I am getting the error like "mainwindow.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QXlsx::Document::~Document(void)" (_imp??1Document@QXlsx@@UAE@XZ) referenced in function "public: void __thiscall MainWindow::Test_Display(void)" (?Test_Display@MainWindow@@QAEXXZ)". I tried adding XLSX_NO_LIB macro to my MainWindow class `

ifndef MAINWINDOW_H

define MAINWINDOW_H

include <QMainWindow>

include "xlsxdocument.h"

namespace Ui { class MainWindow; }

class MainWindow : public QMainWindow { Q_OBJECT

XLSX_NO_LIB

public: explicit MainWindow(QWidget parent = 0); ~MainWindow(); void ReadbinFile(); int Test1(int value); void Test_Display();

private: Ui::MainWindow *ui; }; After including the macro i am getting the below error error: C2143: syntax error : missing ';' before 'public' error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I tried adding the qtxlsx.pri and given the path to my .pro file but still same problem Please let me know how can I resolve the above error

`

anilsharma152 avatar Apr 22 '16 05:04 anilsharma152

XLSX_NO_LIB is only necessary if you do not use qmake, try removing it completely and see if it works.

On a separate note, since the author of this project hasn't been logging in for a while, a mantained version of the library is available here: https://github.com/VSRonin/QtXlsxWriter

VSRonin avatar Apr 22 '16 09:04 VSRonin

Thanks its working But I have one more problem I want to copy one row or column to another. Example B1 to B12 should get copy in C1 to C12 how can I achieve this in same worksheet.

anilsharma152 avatar Apr 25 '16 14:04 anilsharma152

// mySheet is of type Worksheet*
for(int i=1;i<=12;++i){
const Cell* oldCell = mySheet->cellAt(i,2/*Column B*/);
// If you have values
mySheet->write(i,3/*Column C*/,oldCell->value(),oldCell->format());
// or, if you have formulas
// mySheet->writeFormula(i,3/*Column C*/,oldCell->formula(),oldCell->format());
}

VSRonin avatar Apr 26 '16 08:04 VSRonin