+ Reply to Thread
Results 1 to 8 of 8

Thread: Opendocument format read/write *.odt

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Opendocument format read/write *.odt

    The writer already exist on qt version 4.5 having small bug..
    1- writing draw:frame tag (image tag) inside text:span and not on text (block tag)
    2- it not write pagezise info on style head or page margin default

    I start to write a reader today code on:
    Only QT4.5
    http://ppk.ciz.ch/MiniScribus/TextOdfDebug.1.zip

    Only table is not ready why?
    i suppose a bug on QT4.5
    qtable->mergeCells(gorow,gocool,qAbs(cr - 1),qAbs(cs - 1));
    mergeCell can not merge all column from one line if i leave -1
    qtable->mergeCells(gorow,gocool,cr,cs);
    it not merge cell can anybody try it to find bug on qt 4.5

    or can any body confirm a bug on mergeCells?


    Qt Code:
    1. QTextTable *qtable = cur.insertTable(rowCounter,constraints.size(),tf);
    2. int gorow = -1;
    3. int gocool = -1;
    4.  
    5. while ( !line.isNull() ) {
    6. if (line.isElement() ) {
    7. const QDomElement oorow = line.toElement();
    8. if (oorow.tagName() == "table:table-row") {
    9. gorow++;
    10. gocool = -1;
    11. QDomElement oocell = oorow.firstChildElement("table:table-cell");
    12. while (!oocell.isNull()) {
    13. gocool++;
    14. const QTextTableCell ctd = qtable->cellAt(gorow,gocool);
    15. const int cr = qMax(oocell.attribute("table:number-rows-spanned").toInt(),0);
    16. const int cs = qMax(oocell.attribute("table:number-columns-spanned").toInt(),0);
    17. qWarning() << "----- spanning /" << cr << "/" << cs << " gocool->" << gocool << " gorow->" << gorow;
    18. if (qMax(cs,cr) !=0) {
    19. /* can not spanning all column */
    20. qtable->mergeCells(gorow,gocool,qAbs(cr - 1),qAbs(cs - 1));
    21. }
    22. cell = qtable->cellAt(gorow,gocool);
    23. //////void QTextTable::mergeCells ( int row, int column, int numRows, int numCols )
    24. /////////////////qWarning() << " cursor on cella /" << gorow << "/" << gocool;
    25. if (!convertCellTable(oocell,cell,cur,tname,processing)) {
    26. qWarning() << "Error on parse table cell row:" << gorow << " column:" << gocool;
    27. }
    28.  
    29. oocell = oocell.nextSiblingElement("table:table-cell");
    30. }
    31. }
    32. }
    33. line = line.nextSibling();
    34. }
    To copy to clipboard, switch view to plain text mode 



  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    I solved :-)

    /* value must having min 1 or row or int 3-4 not automatic accept 0 */

    Qt Code:
    1. QDomElement oocell = oorow.firstChildElement("table:table-cell");
    2. while (!oocell.isNull()) {
    3. gocool++;
    4. const QTextTableCell ctd = qtable->cellAt(gorow,gocool);
    5. const int cr = qMax(oocell.attribute("table:number-rows-spanned").toInt(),0);
    6. const int cs = qMax(oocell.attribute("table:number-columns-spanned").toInt(),0);
    7. if (qMax(cs,cr) !=0) {
    8. /* value must having min 1 or row or cell */
    9. qtable->mergeCells(gorow,gocool,qMax(cr,1),qMax(cs,1));
    10. }
    11. cell = qtable->cellAt(gorow,gocool);
    12. if (!convertCellTable(oocell,cell,cur,tname,processing)) {
    13. qWarning() << "Error on parse table cell row:" << gorow << " column:" << gocool;
    14. }
    15. oocell = oocell.nextSiblingElement("table:table-cell");
    16. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    Which qt snapshot are you using? I tried to compile 3 snapshots but all of them was buggy and didn't able to compile.

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    Quote Originally Posted by ocean View Post
    Which qt snapshot are you using? I tried to compile 3 snapshots but all of them was buggy and didn't able to compile.
    If you use mingw ... replace the mingw/ path and take the mingw from trolltech mirror.
    ftp://ftp.trolltech.com/qt/source/qt....4.1-mingw.exe
    Take only the compiler... i suppose it have a patch.... i am not sure.

    Only append utlis and minimal sys from self.

    From my 10 mounth old mingw install i found compiler error. after i replace the new mingw + window service pack 3 all running easy....

    snapshots i install :

    Qt Code:
    1. -no-exceptions
    2. -qt-zlib
    3. -qt-libtiff
    4. -qt-sql-mysql
    5. -qt-sql-odbc
    6. -qt-sql-sqlite
    7. -qt-gif
    8. -qt-libpng
    9. -qt-libjpeg
    10. -no-openssl
    11. -no-phonon
    12. -no-webkit
    13. -no-scripttools
    To copy to clipboard, switch view to plain text mode 

    my mysql is on mingw lib path... and mysql running without plug-in

    One from 6 day a go , other from 20080913 i build static.

    Can you help me to write last piece (table) from odt reader?
    svn http://fop-miniscribus.googlecode.co.../TextOdfDebug/

    OOReader.h
    OOReader.cpp

    I not find difference from a table writteln by openOffice and from QT4.5

    My reader can draw table from openOffice odt but not from QT4.5..

    If you dont have qt4.5 to test:
    i build static /qt4.5_st/demos/textedit/ it save *odt Open Document format
    it can only save odt file http://ppk.ciz.ch/MiniScribus/odt/

    and i like to test xslt speed.. from 4.5
    http://englich.wordpress.com/2008/09/10/xsl-t-and-qt/

  5. #5
    Join Date
    Sep 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    Quote Originally Posted by patrik08 View Post
    If you use mingw ... replace the mingw/ path and take the mingw from trolltech mirror.
    ftp://ftp.trolltech.com/qt/source/qt....4.1-mingw.exe
    Take only the compiler... i suppose it have a patch.... i am not sure.

    Only append utlis and minimal sys from self.

    From my 10 mounth old mingw install i found compiler error. after i replace the new mingw + window service pack 3 all running easy....
    I have the latest mingw too, but my mingw can't compile snapshots.

    Can you help me to write last piece (table) from odt reader?
    svn http://fop-miniscribus.googlecode.co.../TextOdfDebug/

    OOReader.h
    OOReader.cpp

    I not find difference from a table writteln by openOffice and from QT4.5

    My reader can draw table from openOffice odt but not from QT4.5..
    If you dont have qt4.5 to test:
    i build static /qt4.5_st/demos/textedit/ it save *odt Open Document format
    it can only save odt file http://ppk.ciz.ch/MiniScribus/odt/
    Sure, if i can (and have enough time), i will help you. But I didn't understand you, you can't create a table by using Qt Tools?

  6. #6
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    Quote Originally Posted by ocean View Post
    I have the latest mingw too, but my mingw can't compile snapshots.
    Sure, if i can (and have enough time), i will help you. But I didn't understand you, you can't create a table by using Qt Tools?
    Qt Code:
    1. ftp://ftp.trolltech.com/qt/snapshots/qt-win-opensource-src-4.4.3-snapshot-20080913.zip
    To copy to clipboard, switch view to plain text mode 

    this snapshots work 100% on my mingw

    Have you Service Pack3 on window XP or you use vista?
    try to build only:
    ./configure bla bla..
    make sub-src
    [only core lib]
    not make all demo designer and tool designer, build at end designer & tool

    Read table from OpenOffice odt file is ok and working..
    Read table from QT4.5 odt file (file created by qt) not working..

    OOReader.h
    OOReader.cpp

  7. #7
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    sorry i mistake version
    this is correct ( it ending all two 913 )

    Qt Code:
    1. ftp://ftp.trolltech.com/qt/snapshots/qt-win-opensource-src-4.5.0-snapshot-20080913.zip
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Opendocument format read/write *.odt

    I have now my OpenDocument reader its possibel to build on qt4.4.1 or > on 4.5 reader already exist...

    Only the listformat tree it show the first level table col-span and row-span are perfect...
    And and one QTextEdit, if You load 30 or more page prepare you mind to wait long time.

    I save source on SVN:
    http://www.qt-apps.org/content/show....?content=80650




+ Reply to Thread

Similar Threads

  1. Is there a known problem with QMimeData on Mac OS X?
    By Wurgl in forum Qt Programming
    Replies: 8
    Last Post: 27th February 2008, 22:21
  2. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48

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