Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Editing a spreadsheet

Editing a spreadsheet

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ZoptuneZ Offline
    ZoptuneZ Offline
    Zoptune
    wrote on last edited by Zoptune
    #1

    Hi,

    I want to edit a spreadsheet (Excel file) and keep the presentation (color, invisible cells,..) because i need to print the table after editing it.

    What is the best way to handle this with Qt ? Convert to HTML ? to csv ? to xml ?
    I'm open to any suggestions :)

    Thanks

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      If you can just select the excel XML format, i would go that route.
      Then just load it as pure xml and change what you need.

      But it depends on what you need to change. if you must do massive changes, xml is annoying as u must add nodes etc the right places.

      1 Reply Last reply
      1
      • ZoptuneZ Offline
        ZoptuneZ Offline
        Zoptune
        wrote on last edited by
        #3

        I just need to add few informations (5 or 6 string).
        If i use xml i will keep the excel graphic ?

        Thank you

        mrjjM 1 Reply Last reply
        0
        • ZoptuneZ Zoptune

          I just need to add few informations (5 or 6 string).
          If i use xml i will keep the excel graphic ?

          Thank you

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Zoptune
          ok, would be really easy with XML format.

          I did not test in newer versions.
          In 2007 office it did not keep
          graphs.
          You should just test it.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            For xlsx files you can try using QtXlsxWriter. it might loose some of the contents of the file if it's very complex so I'd give it a test run.

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            ZoptuneZ 1 Reply Last reply
            5
            • VRoninV VRonin

              For xlsx files you can try using QtXlsxWriter. it might loose some of the contents of the file if it's very complex so I'd give it a test run.

              ZoptuneZ Offline
              ZoptuneZ Offline
              Zoptune
              wrote on last edited by
              #6

              Hi @VRonin and thanks for the reply,

              I don't know how to install module on Qt, can you explain me how to do it ?

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                The homepage, under "Getting started" has quite clear instructions

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                0
                • ZoptuneZ Offline
                  ZoptuneZ Offline
                  Zoptune
                  wrote on last edited by Zoptune
                  #8

                  Yep my bad,

                  But when i include the .pri file i get compiling error about a QVectorQZipReader::FileInfo in the ZipReader::init function

                  VRoninV 1 Reply Last reply
                  0
                  • ZoptuneZ Zoptune

                    Yep my bad,

                    But when i include the .pri file i get compiling error about a QVectorQZipReader::FileInfo in the ZipReader::init function

                    VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #9

                    @Zoptune The original author is not maintaining the project anymore and his/her version is now broken on Qt 5.6. I'm keeping it working in my fork https://github.com/VSRonin/QtXlsxWriter

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    ZoptuneZ 1 Reply Last reply
                    1
                    • ZoptuneZ Offline
                      ZoptuneZ Offline
                      Zoptune
                      wrote on last edited by
                      #10

                      Perfect ! Thank you very much for your work :)

                      1 Reply Last reply
                      0
                      • VRoninV VRonin

                        @Zoptune The original author is not maintaining the project anymore and his/her version is now broken on Qt 5.6. I'm keeping it working in my fork https://github.com/VSRonin/QtXlsxWriter

                        ZoptuneZ Offline
                        ZoptuneZ Offline
                        Zoptune
                        wrote on last edited by
                        #11

                        Hi again @VRonin ,

                        How, do you think, can i print my xlsx doc after editing ?

                        Thx

                        VRoninV 1 Reply Last reply
                        0
                        • ZoptuneZ Zoptune

                          Hi again @VRonin ,

                          How, do you think, can i print my xlsx doc after editing ?

                          Thx

                          VRoninV Offline
                          VRoninV Offline
                          VRonin
                          wrote on last edited by
                          #12

                          @Zoptune The library has no rendering functionality i.e. has no tool to "paint" the excel document, just to edit its parts. If you have excel installed on the machine that should print the file you can try this solution and use QProcess in your program to launch the WScript.exe

                          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                          ~Napoleon Bonaparte

                          On a crusade to banish setIndexWidget() from the holy land of Qt

                          ZoptuneZ 1 Reply Last reply
                          2
                          • VRoninV VRonin

                            @Zoptune The library has no rendering functionality i.e. has no tool to "paint" the excel document, just to edit its parts. If you have excel installed on the machine that should print the file you can try this solution and use QProcess in your program to launch the WScript.exe

                            ZoptuneZ Offline
                            ZoptuneZ Offline
                            Zoptune
                            wrote on last edited by
                            #13

                            @VRonin Yep, this is solution i have seen yesterday, but i don't want to have Excel installed so i use a QProcess that launch LibreOffice to do a convertion in a pdf file and then print the pdf from my app.
                            I'm trying to find if it is possible with QtXlsx to change the document orientation (i need it to be in landscape format).

                            Thx

                            1 Reply Last reply
                            0
                            • VRoninV Offline
                              VRoninV Offline
                              VRonin
                              wrote on last edited by
                              #14

                              There is a pull request on the main project that implements the feature. The author did not submit it to my fork so I did not review and merged it yet but feel free to try it

                              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                              ~Napoleon Bonaparte

                              On a crusade to banish setIndexWidget() from the holy land of Qt

                              ZoptuneZ 1 Reply Last reply
                              1
                              • VRoninV VRonin

                                There is a pull request on the main project that implements the feature. The author did not submit it to my fork so I did not review and merged it yet but feel free to try it

                                ZoptuneZ Offline
                                ZoptuneZ Offline
                                Zoptune
                                wrote on last edited by Zoptune
                                #15

                                @VRonin Sorry but i never used git,

                                Can u explain me how to do ?

                                Thx

                                EDIT : tried but doesn't work, the output file is corrupted

                                EDIT 2 : It's working now :)

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved