Results 1 to 6 of 6

Thread: Writing a html file in Qt4

  1. #1
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Writing a html file in Qt4

    Hi

    I have a problem,I have some data in a c++ structure. I want to write that data in some html file . Sothat i can read that html file in my QTextEdit .

    Now my question is how to generate this HTML file from strcuture data at run time in Qt4. Pleaseeeeeeeee help.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Writing a html file in Qt4

    Quote Originally Posted by AviMittal View Post
    Hi

    I have a problem,I have some data in a c++ structure. I want to write that data in some html file . Sothat i can read that html file in my QTextEdit .

    Now my question is how to generate this HTML file from strcuture data at run time in Qt4. Pleaseeeeeeeee help.
    loop through your structure data and append it to a HTML string, you create.

  3. #3
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Writing a html file in Qt4

    thanks for rplying. But how to append "html" string ?? my html file looks like:

    <HTML>

    <HEAD>

    <TITLE><TITLE>

    </HEAD>

    <BODY>

    <Table border="0" cellpadding="0" cellspacing="0" style="Width:100%;">

    <TR>

    <TD>

    <Table border="0" cellpadding="0" cellspacing="0" style="Width:100%;">

    <TR>

    <TD COLSPAN="2"><BR /></TD>

    </TR>

    <TR style="background-color:LightBlue;">

    <TD>

    To:</TD>



    <TD>aavriti.goyal@TCS.com;&nbsp;aavriti.mittal@gma il.com</TD>

    </TR>

    <TR style="background-color:LightBlue;">

    <TD>

    Attachments:

    </TD>

    <TD>Sample.doc</TD>

    </TR>

    </table>

    </TD>

    </TR>

    <TR>

    <TD>

    <Table border="0" cellpadding="0" cellspacing="0" style="Width:100%;">



    <TR style="font-size:5pt;"><TD>&nbsp;</TD></TR>

    <TR>

    <TD>Classification:</TD>

    <TD>Classification Value</TD>

    </TR>

    <TR>

    <TD>Authorized By:</TD>



    <TD>DTG Value</TD>

    it contains double quotes as well that QString doesnt understand. pls suggest.

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Writing a html file in Qt4

    For double quotes, cant you use - \" ??
    Something like -
    Qt Code:
    1. QString htmlString = QString("<HTML> <BODY> <Table border=\"0\" ..... .... </HTML>");
    To copy to clipboard, switch view to plain text mode 


  5. #5
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Writing a html file in Qt4

    it didnt worked

  6. #6
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Writing a html file in Qt4

    what didn't work?
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

Similar Threads

  1. Reading and writing bytes in file
    By DiamonDogX in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2009, 20:25
  2. Problems writing to file
    By DiamonDogX in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2009, 16:01
  3. how to create html file in memory
    By darksaga in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2007, 09:30
  4. Writing to file at specific
    By safknw in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2006, 11:12
  5. Replies: 1
    Last Post: 18th July 2006, 12:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.