Beiträge von Claire

    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.

    Hello,

    Is there a method to know the size (in Ko) of an TWPObject ?

    I insert a picture (jpg) like that:

    Code
    TWPRichText *wptDoc;
    TWPObject* wpobj;
    wpobj = WPLoadObjectFromFile(wptDoc, "myFilePath", false);
    wptDoc->TextObjects->InsertMovableImage(wpobj);

    I would like to resize the picture until the weight is under 100ko.

    So I was thinking to reduce the height and width until the size is correct. But I don't know how to find the size of my TWPObject.


    Furthermore, I'm currently oblige to load my pictures as links ( with WPLoadObjectFromFile(wptDoc, "myFilePath", true) ). If I don't, when I merge my document, the picture disappears. Is there a way to make it work?

    I hope you can help me.

    Claire.

    Hello,

    I have some problems with the "SelectionAsString" function.

    I have two merge fields like that:
    <<Mergefield_1>>
    <<Mergefield_2>>

    What I try to do is to put my cursor in the right place to add text between the 2 merge fields.

    Code
    pwptDoc->SelStart = 14; (end of the first merge field)
    pwptDoc->SelLength = 0;
    pwptDoc->CPPosition = 14;
    pwptDoc->SelectionAsString = "myString";

    But by doing this, it deletes me the "<<" of the second merge field, which isn't recognize as a merge field anymore.
    (I've already tried just with "pwptDoc->SelectionAsString = "myString";" but it didn't work neither).

    I have noticed that when I'm at the end of the first line and try to select the next character with "Shift+ Right Arrow", it selects the whole second merge field.
    But when I delete the same character I've tried to select before (with the "Del" key), it deletes me the carriage return. Maybe it has something to do with my problem.

    Can you tell me if it's normal? How can I fix my problem?

    Thanks,

    Claire.

    I had nearly the same problem.
    I solved it this way:

    Code
    TWPObject* wpobj;
    wpobj = WPLoadObjectFromFile(wptDoc, OPDImage->FileName, true);
    wptDoc->TextObjects->InsertMovableImage(wpobj);

    I try to merge a TWPRichText document, with 2 tables in it, like this :

    Code
    <<Table1>><<Table2>>

    , where <<Table1>> and <<Table2>> are MergeFields.

    There are combined cells in tables. I create them like that :

    Code
    TParagraph* cell = doc->ActivePar()->GetCell(0,0);
    doc->SelectCell(cell, true);
    
    
    TParagraph* cell2 = doc->ActivePar()->GetCell(0,1);
    doc->SelectCell(cell2, true);
    
    
    doc->CombineCells();


    But when the first table is merge, the merging operation stops.
    So the rest of the document is not merge.
    If I remove all the combined cells, the document merges fine.

    Is there a reason to that?
    Does another way to combine two cells exist?

    Hi,

    With WPTools v.4, we were able to do :

    Code
    TWPRichText.SelectCells(int);
    TWPRichText.CombineCells;

    to merge selected cells horizontally.

    But TWPRichText.SelectCells doesn't exist in v.6.

    Could you tell me how I can do that with v.6?

    Thanks.

    It works fine with:

    Code
    par := WPRichText1.FirstPar;
    while(par<>nil) do
      begin
         if par.ANSIText= 'test' then
            par := par.DeleteParagraphEnd;
            par := par.NextPar;
         else par := par.NextPar;
      end;
    WPRichText1.ReformatAll(false, true);


    Thanks!

    I want to delete the carriage return if the word I'm searching is alone on the line.
    I'm doing that this way :
    (wpDoc is a TWPRichText)


    I use a button to launch the function.

    The function works perfectly when I click on the button immediately after loading the RTF File in the editor, but when I click on the TWPRichText before launching the function, it deletes more text than needed.

    Do I use the right way to do what I want to do? Is there any better solution?
    Why doesn't the function work every time I try it?

    I need help please.
    Thanks.

    Hi,
    We try to do a sort of direct-mailing system.
    To do that, we have to duplicate data which are in a list like this :

    Code
    <begin list of code>   - <Code Name> : <Code Description><end list of code>

    If I have a 3 elements' list, the first thing that I would do is to copy the content of the list :

    Code
    <begin list of code>   - <Code Name> : <Code Description>   - <Code Name> : <Code Description>   - <Code Name> : <Code Description><end list of code>


    This is the code I'm using to copy the content of the list and to delete the start list tags and end list tags :

    Code
    AnsiString cpText;   int beginListPos = 0;   int endListPos = 0;    //find the last start list tag   while(wpDoc->Finder->Next(beginList))   {      beginListPos = wpDoc->Finder->FoundPosition;   }    //find the first end list tag   wpDoc->Finder->Next(endList);   endListPos = wpDoc->Finder->FoundPosition;   wpDoc->Finder->Clear();   int lg = endListPos - beginListPos - 7; //7 because of the length of the start list tag length    //select the text to copy   wpDoc->SetSelPosLen(debutListe + 6, lg, true); //6 because of the length of the start list tag length   cpText = wpDoc->SelectionAsString;    //delete the start list and end list tags   wpDoc->SetSelPosLen(beginListPos - 1, endListPos - beginListPos + 6, true);   wpDoc->ClearSelection(true);   for (int j = 0; j < 3; j++) //3 stand for the number of elements in the list    {      //paste the text      wpDoc->CPPosition= beginListPos - 1;      wpDoc->SelectionAsString = cpText;    }


    Is this the right way to do what I want to do? Do I use the right method?


    I also have a problem with this line :

    Code
    wpDoc->SetSelPosLen(beginListPos - 1, endListPos - beginListPos + 6, true);

    When I have only a list, it woks fine.
    But when I have 2 or more lists like this :

    Code
    <begin list of code>
        <begin 2nd list of code>
            - <Code Name> : <Code Description>
           - <Code Name> : <Code Description>
           - <Code Name> : <Code Description>
        <end 2nd list of code>
    <end list of code>


    it causes an EAccessViolation exception and I don't understand why...

    Thanks.