Results 1 to 3 of 3

Thread: Formatting Excel File

  1. #1
    Join Date
    May 2009
    Posts
    94
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Question Formatting Excel File

    I have one excel sheet with data filled.I want to open the file.After Opening the file i want to change the color and format the text of column header.

    I am able to open a file using QFile::Open() but, i dont know how to doformatting.Please help ragarding this.Thank You

  2. #2
    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: Formatting Excel File

    XLS are binary files so you have to open them as a binary, but then you can read only raw bytes of that file, because there is no such API in Qt that allows you to manipulate XLS files on some higher level than bytes. So you have to find some library that can do this or you have to know the format of the xls file to understand what bytes you read mean.

    P.S. Different thing is with xlsx and docx new formats, because they are just zipped set of xml files, so you can use than for example DOM API in Qt, but you still have to know what that tags, attributes and values mean - you have to know the file format, structure.
    Last edited by faldzip; 27th May 2009 at 08:03.
    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.

  3. #3
    Join Date
    Sep 2006
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Formatting Excel File

    Excel works quite well with HTML formatted files. If you generate an HTML table with colored cells and write it to a file with .xls extension (even when in reality its a text based HTML file), Excel will detect this and render the resulting table quite nicely.

    Of course this only works with rather simple tables, I don't know if you can have formula's and such.

Similar Threads

  1. How can I Read Write Excel File
    By xingshaoyong in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2011, 20:16
  2. How to read Excel file with Qt
    By HelloDan in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2009, 20:27
  3. QT equivalency of perl's pack to EXCEL binary file
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2008, 16:20
  4. Number formatting for file name construction
    By philwinder in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2008, 10:57
  5. Read \Write Excel File using Qt
    By xingshaoyong in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 22:07

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.