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. How to Save my TableView as an Excel File ?
Forum Updated to NodeBB v4.3 + New Features

How to Save my TableView as an Excel File ?

Scheduled Pinned Locked Moved General and Desktop
14 Posts 3 Posters 11.0k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Hi Developers,

    I Really don't know whether this thing is Possible or not. Can i Save my QTableView as a .xls File (Excel File) ? I have a TableView and a Button. If I enter the values in the Table and once if i click the button, the TableView should be Saved as an Excel File. Please give your valuable suggestions.

    Thanks & Regards

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Hi, ~Riz!

      I haven't tried it yet but I it's not hard to find a bit on qt devnet.

      http://qt-project.org/wiki/Handling_Microsoft_Excel_file_format

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        There is no support for excel format in Qt, but maybe in your case a .csv file would be enough? Excel opens them just fine and writing to it is as simple as iterating through the table cells and inserting semicolons between so basically a short loop.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Macro
          wrote on last edited by
          #4

          [quote author="tucnak" date="1352741847"]Hi, ~Riz!

          I haven't tried it yet but I it's not hard to find a bit on qt devnet.

          http://qt-project.org/wiki/Handling_Microsoft_Excel_file_format[/quote]

          Thanks for your link tucnak.. :-)

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tucnak
            wrote on last edited by
            #5

            [quote author="Riz" date="1352748048"]
            [quote author="tucnak" date="1352741847"]Hi, ~Riz!

            I haven't tried it yet but I it's not hard to find a bit on qt devnet.

            http://qt-project.org/wiki/Handling_Microsoft_Excel_file_format[/quote]

            Thanks for your link tucnak.. :-)[/quote]

            You are welcome. So if issue solved, you should:
            @
            Devnet::Thread *q = Devnet::Instance()->currentThread();
            q->setHeading( q->heading().prepend("[SOLVED] ") );
            q->update();
            @

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Macro
              wrote on last edited by
              #6

              [quote author="Krzysztof Kawa" date="1352745993"]There is no support for excel format in Qt, but maybe in your case a .csv file would be enough?.[/quote]

              Yeah.. That's Fine for my case.. Can u plz give me an example of it.

              Thanks and Regards

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Macro
                wrote on last edited by
                #7

                Yeah I know that tucnak..

                Thanks & Regards

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tucnak
                  wrote on last edited by
                  #8

                  There were to many mistakes in my code. Now it's OK :-).

                  1 Reply Last reply
                  0
                  • Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    [quote author="Riz" date="1352748263"]
                    Yeah.. That's Fine for my case.. Can u plz give me an example of it.
                    [/quote]
                    C'mon man, put some google into it ;)
                    But ok, here you go, example of csv file: http://en.wikipedia.org/wiki/Comma-separated_values#Example

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tucnak
                      wrote on last edited by
                      #10

                      [quote author="Krzysztof Kawa" date="1352749847"]
                      [quote author="Riz" date="1352748263"]
                      Yeah.. That's Fine for my case.. Can u plz give me an example of it.
                      [/quote]
                      C'mon man, put some google into it ;)
                      But ok, here you go, example of csv file: http://en.wikipedia.org/wiki/Comma-separated_values#Example[/quote]

                      Yes, it's common problem of our new generation. We are lazy, it's too hard for us to search a bit on devnet or to google. But I try to fight with my lazy-side :-).

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Macro
                        wrote on last edited by
                        #11

                        [quote author="tucnak" date="1352750634"][quote author="Krzysztof Kawa" date="1352749847"]
                        [quote author="Riz" date="1352748263"]
                        Yeah.. That's Fine for my case.. Can u plz give me an example of it.
                        [/quote]
                        C'mon man, put some google into it ;)
                        But ok, here you go, example of csv file: http://en.wikipedia.org/wiki/Comma-separated_values#Example[/quote]

                        Yes, it's common problem of our new generation. We are lazy, it's too hard for us to search a bit on devnet or to google. But I try to fight with my lazy-side :-).[/quote]

                        Yeah You are Right Tucnak... Even sometimes i feel lazy to Search in devnet or to google it... My Apologies for that. As Tucnak said, I 'll also wll try to fight with my lazy side... :-)

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          Macro
                          wrote on last edited by
                          #12

                          Thanks for your link Krzysztof Kawa... You saved my time in googling it... :-)

                          Thanks & Regards

                          1 Reply Last reply
                          0
                          • Chris KawaC Offline
                            Chris KawaC Offline
                            Chris Kawa
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Just think about it next time. I lost 10s of my life copy/pasting it so you can save 5s of yours googling it :P

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Macro
                              wrote on last edited by
                              #14

                              100% True... I Will think about it next time.. :-)

                              Thanks & Regards

                              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