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. Document Appending
Forum Updated to NodeBB v4.3 + New Features

Document Appending

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 3.6k 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.
  • V Offline
    V Offline
    Vidhya
    wrote on last edited by
    #1

    how can i append or overload two html document (one contains the image and another contains text and image ) to a single document using
    QTextDocumentWriter

    // FORMAT HTML
    @ QTextDocumentWriter writer("./XXXXXXX.html");
    @ writer.setFormat("html");
    @ //writer.
    @---- writer.write(doc);
    @ writer.write(doc1);

    its not working only the doc1 is wrote because i mention it in the last if i mention doc then the doc is wrote in the html file

    Regards,
    Vidhya

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Create a QTextDocument from the first HTML fragment.
      Create a QTextDocument from the second HTML fragment.
      Using QTextCursor and QTextDocumentFragment insert the second document at the end of the first document.
      Write the first document to file.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vidhya
        wrote on last edited by
        #3

        Thank For Ur response i will try this..

        Regards,
        Vidhya

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vidhya
          wrote on last edited by
          #4

          @
          QString ltext ="<img />";
          QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(ltext);
          cursor.insertFragment(fragment);
          @

          but the next string comes under the base line of the image

          i need Image in the corner if the html and the title ( Heading) is in the same line and aligned center like our qt html page (logo of qt ) and the Developer Network string in the same line ( no in the base of the logo-image )

          [Edit: Added @ tags; mlong]

          Regards,
          Vidhya

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            This code snippet inserts an empty image (what is the point of that?) at the specified cursor position. It doesn't attempt to insert text anywhere.

            We cannot read your mind and have no idea what you mean unless you tell us. You asked to append one HTML document onto another but now it seems you want some magic definition of 'append' that you describe in terms of some assumed knowledge of a document and requirement that we clearly do not have.

            If you are going to persist using HTML to build up a description of a page then I suggest you learn some HTML/CSS first. If you want an image (or paragraph) to float to the left/right out of the natural top-to-bottom flow of a page then your HTML/CSS needs to say so. There's plenty of information in the Qt documentation on "Rich Text processing" and the "Supported HTML Subset" but it is not an HTML/CSS tutorial.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vidhya
              wrote on last edited by
              #6

              I wan image at the top left corner and the text in the center (Botrh are in the same line)
              How can i achieve this using QTextCursor

              Regards,
              Vidhya

              1 Reply Last reply
              0
              • K Offline
                K Offline
                KA51O
                wrote on last edited by
                #7

                I suggest you have a look at these links: "HTML":http://www.w3schools.com/html/default.asp "CSS":http://www.w3schools.com/cssref/default.asp

                QTextCursor is least suited for HTML layout tasks.

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Vidhya
                  wrote on last edited by
                  #8

                  ok thank u

                  Regards,
                  Vidhya

                  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