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. Print ODT File
Forum Updated to NodeBB v4.3 + New Features

Print ODT File

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 1.2k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    I think you should take a look at Okular, they have support for odt files.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    1
    • C ckvsoft

      Hallo
      I'm looking for stupid. Is there a way to print existing .ODT files from QT?
      lf Chris

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #5

      @ckvsoft
      As @SGaist says. No builtin support in Qt. However, if Okular route is not your thing, are you under Linux (Debian)?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ckvsoft
        wrote on last edited by
        #6

        Okular do chris but very bad. Styles are missing. I van convert to html this looks Good in Firefox but mit in QtextDocument
        Is There a List wich html tags QTextDocument understand?
        Or do you know a third party class

        Lg chris

        JonBJ 1 Reply Last reply
        0
        • C ckvsoft

          Okular do chris but very bad. Styles are missing. I van convert to html this looks Good in Firefox but mit in QtextDocument
          Is There a List wich html tags QTextDocument understand?
          Or do you know a third party class

          Lg chris

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #7

          @ckvsoft
          You did answer whether you are under Linux (Debian)? You can print --- which is what you said you want to do --- from there if so without trying to read it in. I don't think you will be able to "read" ODT file into Qt/QTextDocument.

          C 1 Reply Last reply
          0
          • JonBJ JonB

            @ckvsoft
            You did answer whether you are under Linux (Debian)? You can print --- which is what you said you want to do --- from there if so without trying to read it in. I don't think you will be able to "read" ODT file into Qt/QTextDocument.

            C Offline
            C Offline
            ckvsoft
            wrote on last edited by
            #8

            @JonB
            Currently ubuntu.
            Open read and convert is not the Problem. But QTextDocument has limited html tags. So i can print but ist not formated as it schould be.So i am searching for a lib that can do this.
            Install libre is Overkill for only print a odt.
            Okular will also Show without styles.

            Lg chris

            JonBJ 1 Reply Last reply
            0
            • C ckvsoft

              @JonB
              Currently ubuntu.
              Open read and convert is not the Problem. But QTextDocument has limited html tags. So i can print but ist not formated as it schould be.So i am searching for a lib that can do this.
              Install libre is Overkill for only print a odt.
              Okular will also Show without styles.

              Lg chris

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #9

              @ckvsoft
              If you are saying you have HTML, QWebEnginePage can print that.

              C 2 Replies Last reply
              1
              • JonBJ JonB

                @ckvsoft
                If you are saying you have HTML, QWebEnginePage can print that.

                C Offline
                C Offline
                ckvsoft
                wrote on last edited by
                #10

                @JonB
                Thx. I will try this today. Good idea
                Lg chris

                1 Reply Last reply
                0
                • JonBJ JonB

                  @ckvsoft
                  If you are saying you have HTML, QWebEnginePage can print that.

                  C Offline
                  C Offline
                  ckvsoft
                  wrote on last edited by
                  #11

                  @JonB
                  Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                  lg Chris

                  mrjjM JonBJ 2 Replies Last reply
                  0
                  • C ckvsoft

                    @JonB
                    Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                    lg Chris

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

                    Hi
                    That sounds like a bummer.
                    Could you try
                    https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-html2pdf-example.html

                    and see if that give same result ?

                    1 Reply Last reply
                    3
                    • C ckvsoft

                      @JonB
                      Incredible. QWebEnginePage show shows me everything wonderfully, but the print preview / printout is a blank page

                      lg Chris

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #13

                      @ckvsoft
                      We use it to print HTML->PDF. You have to be careful about how your code works, to do with QWebEnginePage being asynchronous, IIRC. Please give a go to @mrjj's example.

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        ckvsoft
                        wrote on last edited by
                        #14

                        Summarized:
                        I'll keep looking. I had no idea that it would be so cumbersome.
                        First I wrote a class that uses an OTT as a template to create the ODT file. At that time I did not know that it was cumbersome to display or print this file. Converted to HTML is not displayed correctly by QtextEdit. So we have to use QWebEngine. But now I noticed that the conversion to html is also not 100%. During this time I would have probably written my own template designer. I actually wanted to avoid that. I have no idea what I'm going to do now.

                        lg Chris

                        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