Problems saving document with pictures

  • Hi,

    The first time I save a document with a picture in it, it works fine.
    When I look at MyDoc->AsString.c_str(), it's exactly what I expect.

    But when I save it again with the same name, MyDoc->AsString.c_str() is nearly empty. When I open it afterthat, the document is totally empty.

    Code
    { "{\\rtf1\\ansi\\deff0\\uc1\\ansicpg1252\\deftab720{\\fonttbl{\\f0\\fnil\\fcharset1 Arial;}{\\f1\\fnil\\fcharset2 Wingdings;}}{\\colortbl\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;\\red255\\green255\\blue0;\\red255\\green0\\blue255;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red0\\green255\\blue0;\\red0\\green255\\blue255;\\red0\\green128\\blue128;\\red0\\green0\\blue128;\\red255\\green255\\blue255;\\red192\\green192\\blue192;\\red128\\green128\\blue128;\\red0\\green0\\blue0;}\\wpprheadfoot1\\paperw11906\\paperh16838\\margl940\\margr940\\margt720\\margb720\\headery720\\footery720\\endnhere\\sectdefaultcl{\\*\\generator WPTools_5.370;}{\\plain\\fs22{\\shp{\\*\\shpinst\\shpleft5114\\shptop240\\shpright10305\\shpbottom3802\\shpbypara\\shpbxpage{\\sp{\\sn shapeType}{\\sv 75}}{\\sp{\\sn pib}{\\sv{\\shpwr2\\shpwrk0\\pict\\jpegblip\\picw23415\\pich16065\\picwgoal5191\\pichgoal3562\r\n\\bin56607 ÿØÿà", 859, 171214 }

    Maybe it has something to do with the way I insert pictures into the document, because it only appears when there is at least one picture into the document.

    Code
    MyDoc->SetFocus();
    TWPObject* MyObj;
    MyDoc->WriteObjectMode = wobRTFNoBinary;
    MyObj = WPLoadObjectFromFile(MyDoc, image.getUrl() , false);
    MyDoc->TextObjects->InsertMovableImage(MyObj);

    It's very annoying. Is there a way to fix that?
    Thanks.

    Claire.