Results 1 to 8 of 8

Thread: .xls files

  1. #1
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default .xls files

    Hi,
    I want to be able to read/write simple excel spreadsheets (don't we all?) using QtCreator for Windows.

    I've tried to use xlslib, but using a Windows system I have problems getting this to work (see this sourceforge thread).

    What I actually need is just write numbers/strings to cells. Formatting, formulas, different sheets etc. would be nice-to-have, but absolutely not necessary.I can't take the ActiveX approach because I need a multi-platform solution - I am building the program for Windows and for Android (more to come later).

    Has anyone managed to integrate xlslib into Qt under Windows?
    Is there a simpler alternative?

    As this post intends to aim for the Qt side of my problem, please forgive my cross posting (see link above) concerning my efforts to specifically deal with the xlslib side of it.

    Any help/hint/link is gratefully appreciated!

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Question including xlslib in Qt Creator (was: Re: .xls files)

    Hi,
    by now I think I have managed to build xlslib. I'll list the necessary steps cleanly in this thread as soon as I know this leads to success.
    After running make I've encountered some nice xls sheets from test programs. Yesss.

    My question: I've managed that by compiling the package via Cygwin from a command line - how do I get the result of that integrated into a Qt project in the Creator?

    Or, specifically:
    • What am I looking for? A .dll? A .lib? (nothing there)
    • Do I need all the .o-Files somewhere?
    • Do I have to include the makefile in my toolchain (whatever the latter actually means)?
    • How do I refer to it in the Creator? Via #include?

    You see - I'm a n00b looking for some very basic advice here :-\

    I've uploaded the folder with the compiled xlslib here (file was too big to attach it to the post).

    I am sure, Excel support is what *many* programmers want to have and imho there's not much information out there for beginners like me. It would be so nice if we could change that here and if this thread resulted in a how-to!
    Last edited by sedi; 14th November 2012 at 01:26.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    If you have built xsllib under Cygwin then it is unlikely there will be a straightforward way to integrate this library with a program built outside Cygwin.

    As far as I can tell xlslib comes with project files for MSVC 2005 and 2008 and has reports of successful builds with MingW. You should build xlslib with a the same compiler as your Qt libraries and project, then linking against it becomes trivial.

  4. The following user says thank you to ChrisW67 for this useful post:

    sedi (15th November 2012)

  5. #4
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    Thank you for the answer!

    If I understand you correctly, I want to
    1. Understand Qt project file syntax and logic
    2. Understand the MSVC .vcproj file
    3. "Translate" the .vcproj into a .pro file
    4. -> Either include this into my project and compile/build xlslib together with my stuff.
    5. -> or compile it to a .dll or .lib or something else (what?) and link my project against it.


    Is that correct?
    Is it right that the .pro file actually "tells" qmake what to do?
    Is option 4 better than 5 when I want this to run multi-platform? By now I have my project running with Win & Android, others shall follow.

    I'm only starting to hopefully understand this cosmos, sorry.

    The Cygwin compiling needed the use of a "bootstrap" and a "configure" script that apparently generated a "makefile" script which, I think, did the actual compiling. Is it right that a correct .vcproj or .pro file would (have to) care of all the things those scripts do? I mean: can I assume that I don't need to dig deeper into the shell scripts? Being a Linux n00b, they tend to look like the results of a well-oiled armadillo rolling itself over a computer keyboard, in my eyes at least. It would be quite encouraging to be able to toss them aside and "just" learn to work the project files ;-)

    I've found
    http://doc.qt.digia.com/stable/qmake-project-files.html
    and
    http://doc.qt.digia.com/qt/qmake-var...reference.html
    as possible starting points for the Qt side,

    and this
    http://www.asp.net/web-forms/tutoria...e-project-file
    seems to be interesting for the MS side.

    Do these pages look reasonable as starting points for this case? Would you recommend better resources?

    Sorry for these many questions, I just genuinely want to understand this.
    Last edited by sedi; 15th November 2012 at 19:17.

  6. #5
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    I am still not sure, if I understand the answer correctly. I'd really appreciate advice about if what I tried to derive from it is the right way to go or if I got it wrong.

  7. #6
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    if you want to use xlslib with qt, then the .libs need to be compiled with same compiler. You compiled xlslib under cygwin - did you ALSO compile Qt under cygwin?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  8. The following user says thank you to amleto for this useful post:

    sedi (17th November 2012)

  9. #7
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    Thank you amleto! This I have indeed understood - I can obviously not use what I have compiled with gcc under cygwin. There were no .lib, .dll or .so files anyway - which I thought to be odd. But this whole approach is futile in the first place, like you've said.

    So right now (maybe I should have stated that clearer, sorry!) I am trying to compile the xlslib source code in Qt - which uses the mingw compiler.

    Does that sound more reasonable with the ideas of post #4 in this thread?

  10. #8
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: including xlslib in Qt Creator (was: Re: .xls files)

    to be pedantic, you cant compile xlslib with Qt since Qt doesn't have a c++ compiler. But, yes, compiling xlslib with mingw c++ compiler (you'll need a makefile?) is reasonable considering your Qt libs were also built with mingw.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  11. The following user says thank you to amleto for this useful post:

    sedi (17th November 2012)

Similar Threads

  1. Replies: 5
    Last Post: 30th October 2012, 08:52
  2. Replies: 1
    Last Post: 15th August 2011, 23:26
  3. Replies: 12
    Last Post: 17th June 2009, 05:34
  4. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 21:05
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 00:06

Tags for this Thread

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.