Results 1 to 2 of 2

Thread: QTextOdfWriter

  1. #1
    Join Date
    Mar 2010
    Posts
    107
    Thanks
    22
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextOdfWriter

    Hi
    I am looking into writing data from a QTextEdit to a file format of my own design.
    During research I looked at the code in QTextOdfWriter.
    When this class is wrting a FrameFormat it uses the following code –
    if (format.hasProperty(QTextFormat::BlockTopMargin))
    writer.writeAttribute(foNS, QString::fromLatin1("margin-top"), pixelToPoint(qMax(qreal(0.), format.topMargin())) );
    if (format.hasProperty(QTextFormat::BlockBottomMargin ))
    writer.writeAttribute(foNS, QString::fromLatin1("margin-bottom"), pixelToPoint(qMax(qreal(0.), format.bottomMargin())) );
    if (format.hasProperty(QTextFormat::BlockLeftMargin))
    writer.writeAttribute(foNS, QString::fromLatin1("margin-left"), pixelToPoint(qMax(qreal(0.), format.leftMargin())) );
    if (format.hasProperty(QTextFormat::BlockRightMargin) )
    writer.writeAttribute(foNS, QString::fromLatin1("margin-right"), pixelToPoint(qMax(qreal(0.), format.rightMargin())) );

    Note that is checking BlockTopMargin etc.

    Should this in fact be FrameTopMargin etc?

    Thanks

  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: QTextOdfWriter

    Yes it write root frame & block frame table frame

    and convert pixel to point or mm point and pixel having a small faktor...

    #define POINT_TO_CM(cm) ((cm)/28.3465058)
    #define POINT_TO_MM(mm) ((mm)/2.83465058) //////// 0.352777778
    #define POINT_TO_DM(dm) ((dm)/283.465058)
    #define POINT_TO_INCH(inch) ((inch)/72.0)
    #define POINT_TO_PI(pi) ((pi)/12)
    #define POINT_TO_DD(dd) ((dd)/154.08124)
    #define POINT_TO_CC(cc) ((cc)/12.840103)

    #define MM_TO_POINT(mm) ((mm)*2.83465058)
    #define CM_TO_POINT(cm) ((cm)*28.3465058) ///// 28.346456693
    #define DM_TO_POINT(dm) ((dm)*283.465058)
    #define INCH_TO_POINT(inch) ((inch)*72.0)
    #define PI_TO_POINT(pi) ((pi)*12)
    #define DD_TO_POINT(dd) ((dd)*154.08124)
    #define CC_TO_POINT(cc) ((cc)*12.840103)

    check the reader
    http://qt-apps.org/content/show.php/...?content=80650

    you find a oasi doc debugger on http://manual-indexing.googlecode.co.../RTF_OASI_DOC/

    http://manual-indexing.googlecode.co...todfwriter.cpp

    doc: http://doc.trolltech.com/4.6/richtext-html-subset.html

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.