QXlsx icon indicating copy to clipboard operation
QXlsx copied to clipboard

opening doc erases chart style data

Open zzmiyy opened this issue 4 years ago • 3 comments

Hello! I have trouble with writing docs. Im using template document with multiple sheets and some charts, for example its "point with smooth curves" and some style settings . Im copy template with QFile, opening, filling data into one sheet and save doc. After open i can see, that my chart now is "point with straight lines and markers", and all style settings erased. It is a bug or i do smth wrong?

zzmiyy avatar Aug 31 '21 16:08 zzmiyy

Can you please post some publicly available example code? I think I or others can help you.

Please pull request to repo. https://github.com/JayTwoLab/qxlsx-issues-177

j2doll avatar Sep 05 '21 12:09 j2doll

Can you please post some publicly available example code? I think I or others can help you.

Hello, here's examples:

     if(!QFile::copy(QDir::currentPath() + QDir::separator() + "before.xlsx",
                    QDir::currentPath() + QDir::separator() +"after.xlsx"))
    {
        QFile::remove(QDir::currentPath() + QDir::separator() +"after.xlsx");
        QFile::copy(QDir::currentPath() + QDir::separator() + "before.xlsx",
                    QDir::currentPath() + QDir::separator() +"after.xlsx");
    }
    {       //example 1
        QXlsx::Document doc(QDir::currentPath() + QDir::separator() +"after.xlsx");
        doc.load();
        doc.write(1,1, "HELLO EXCEL WORLD");
        doc.save();
    }
    {       //example 2
        QXlsx::Document doc(QDir::currentPath() + QDir::separator() +"before.xlsx");
        doc.load();
        doc.write(1,1, "HELLO EXCEL WORLD");
        doc.saveAs(QDir::currentPath() + QDir::separator() +"after2.xlsx");
    }

before.xlsx after.xlsx after2.xlsx

zzmiyy avatar Sep 06 '21 09:09 zzmiyy

I applied the example code to: https://github.com/JayTwoLab/qxlsx-issues-177

It seems that the chart properties part should be checked.

j2doll avatar Sep 25 '21 13:09 j2doll