QtXlsxWriter icon indicating copy to clipboard operation
QtXlsxWriter copied to clipboard

read acces violation

Open Begude opened this issue 8 years ago • 2 comments

Hi, i'm using QtXlsx to read data in anExcel file. It works for some cells :

1 2 QVariant(QString, "Date /heure : 1 3 QVariant(double, 42706) 1 4 QVariant(double, 0.5625) 1 5 QVariant(QString, "OpÚrateur :") 1 6 QVariant(QString, "Trescal ") 1 7 QVariant(QString, "Lieu :") 1 8 QVariant(QString, "Trescal ")

and then I got this message on the line Q_DECLARE_PRIVATE(Cell) :

xlsx\xlsxcell.h:42: erreur : Exception at 0xdb48a, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance)

my code :

    QVariant v1;
    for (int iLig=1; iLig <= 68; iLig++)
    {
        for (int jCol=2; jCol <= 12; jCol++)
        {
            v1 = xlsx.cellAt(iLig, jCol)->value();
            if (v1 != QVariant::Invalid) qDebug() << iLig  << jCol << v1;
        }
    }

xlsxcell.cpp :

/*!
 * Return the data content of this Cell
 */
QVariant Cell::value() const
{
    Q_D(const Cell);
    return d->value;
}

xlsxcell.h :

class Q_XLSX_EXPORT Cell
{
    Q_DECLARE_PRIVATE(Cell)

Can you help me ? Regards

Begude avatar Feb 10 '17 13:02 Begude

Hi, This project is unmaintained, I'm trying to keep it alive in my fork could you post this bug there too and attach a minimal example of an xlsx file that triggers the problem?

From the first look it seems you are trying to access a non-existent cell, i.e. xlsx.cellAt(iLig, jCol)==NULL

VSRonin avatar Feb 13 '17 08:02 VSRonin

Hi, thank you for your answer. This is an example of the type of file I'd like to read : test2.xlsx

You're right, I've added the test : if(xlsx.cellAt(iLig, jCol) != NULL) and it works.

The "xlsx.read" works for me for all cells (even NULL) but sometime there is a formula and I need the value of the cell, so I use "xlsx.cellAt(iLig, jCol)->value();" .

Thanks again for your work, that's OK for me.

Begude avatar Feb 13 '17 09:02 Begude