Document Appending



  • 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



  • 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.



  • Thank For Ur response i will try this..



  • @
    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]



  • 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.



  • 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



  • 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.



  • ok thank u


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.