Beiträge von dstante

    I am not using HTML. Just dropping the TWPRichText and then getting the text it has stored in memory. There may be a simpler explanation.

    I have a TWpRichtext, and add the text the value "«{ Line }»". When checking the value of the text in the control with wprichtext1.asstring, the « and » characters are not in the asString. So apparently there is no way to check for these characters in the text, correct?

    So even the stringrepalce you recommended below does not work because it will not find the text to do the replacement on.

    Is there a way to have the richtext identify the «?

    thanks,

    D____

    Expanding on this: We use codes encased in these brackets in the body of the text for example
    «{Test Code}»
    With version 7, I cannot tell how to determine programmatically that the « or » are used in the text. They apparently do not show up in the ActiveText.RTFText.AsString; or in the richtext.asstring.

    Here is the working code from WP6 which is no longer working in WP7. Any suggestions to get WP7 to find the codes?

    with WPRichText1 do begin
    ActiveText := HeaderFooter.Get(wpIsHeader, wpraOnAllPages);
    HeaderText := ActiveText.RtfText.AsString;
    while Pos('«{', (HeaderText)) > 0 do begin
    c1 := Pos('«{', (HeaderText))+2;
    c2 := Pos('}»', (HeaderText))-1;
    Line := Copy(HeaderText, c1, c2-c1+1);
    Repl := '«{' + Line + '}»';
    with Finder do begin
    ToStart;
    EndAtSpace := True;
    WholeWord := False;
    CaseSensitive := False;
    while Next(repl) do begin
    SelectText;
    SelText := ReplaceVariables('{' + Line + '}') ;
    end;
    EndAtSpace := False;
    end;
    HeaderText := ActiveText.RtfText.AsString;
    end;
    end;

    Hello. We create documents with special instructions embedded in the text. We use the characters "«" and "»" to reference the instructions. In WP6 these characters were stored internally in the text and could be searched using ActiveText.RTFText.asString then searching for those characters within the string. It appears that in WP7, this is stored internally as &#171 and &#187. This would represent quite a change to existing code. Is there a way to make this backward compatible?

    Hello. I am storing data in a database about inserted images. I need to delete the record from the database when the user deletes the image from the text. How can I tell when the user deletes a particular image from the text?

    I have tried adding:
    txtObj.OnDestroy := DeleteImage;
    when inserting the image into the richtext.

    But that only works during that session of the program.

    Any help appreciated.

    I have an applicaiton where I am createing many PDF documents in a loop. It works for many iterations (about 800+), but then fails throwing memory errors. Here is the Code:

    function TForm1.WriteToPDF(pageIndex: Integer; var fileName: String) : Boolean;
    var pdf : TWPPDFExport;
    begin
    fileName := FormatDateTime('mmddyyhhmmss', now) + '.PDF';
    Result := False;
    try
    pdf := TWPPDFExport.Create(nil);
    pdf.DLLName := IncludeTrailingPathDelimiter(ExtractFilePath(Application.exename)) + 'wPDF300A.dll';
    pdf.Source := reMerge; // re Merge = TWPRickText
    pdf.AutoLaunch := False;
    pdf.FontMode := wpEmbedSubsetTrueType_UsedChar;
    pdf.FileName := fileName;
    pdf.Print;
    Result := True;
    finally
    pdf.Free;
    end;
    end;

    If I comment out the line "pdf.print;", the applicaiton sails throguh with no issues for thousands of iterations.

    Am I implementing wrong or is there a defect in PDF.print that possibly was fixed?

    I am using Delphi 2010.
    WPDF tool version = 3.62
    WPDF300A.dll version = 3.54.1.0

    Thank you for Info

    I have updated to 6.29 and still no luck. I need for the text to be inserted at the indent level of teh destination edit. The code is bringing the paragraph indentations of the source box. If it will always uuse the source indent, I may be able to manually store and then set the indent level.

    What is latest version of 6 you are using? I have 6.21.

    To reproduce, place a button and two RichText components (from and To), each with an associated h-ruler.

    Add to the button click:
    ToRichText.SelText := FromRichText.Text

    Move the indent over on the ruler for the To edit. Then add a couple lines in the from box (hit return between lines). THen click the button. THe First line copied in should be on the indent, but the remaining lines will appear on the left margin rather then indented.

    I have also tried:

    ToRichEdit.SelectionAsString := reFrom.asString;

    and

    ToRichEdit.InputString(reFrom.Text); //THis one ignores the indent on the ruler completely.

    The goal is to have all lines indented as set by the ruler in the poaragrpah where the text is inserted.

    There is a difference between WPTools5 and WPTools6 that is causing me an issue.

    I am Moving text from one RichText to Another simply with:

    ToEdit.SelText := FromEdit.Text

    In the ToEdit, I have a ruler with a margin set. With WPTools5, the text new text is added at teh margin regardless of carriage returns (all new paragraphs start at teh indent margin). With WpTools6, the new text ignores the margin and inserts the text to the far left.

    Is there a way to get 6 to behave like 5? Or a better way of doing? I have tried SelectionasString, but that carries the margins of the source box with it and I do not want that.

    Thank you

    Hello. I am performing a search for text in WPTools 5. When the text is found I want the RichText to scroll down so that the found text is visible on the screen. Me search code is below.


    I am trying to use TopOffset becuase I am not familiar with another way to "Move to Cursor". If there is a way to do that please let me know. That will save some time.

    But the problem I am havin is that CPLineNr is often returning 0 even when the cursor is not at line 0.

    LN := reMain.CPLineNr;
    if edFinder.Text <> '' then begin
    if reMain.Visible then begin
    with reMain.Finder do begin
    EndAtSpace := False;
    WholeWord := False;
    CaseSensitive := False;
    Next(edFinder.Text);
    SelectText;
    reMain.TopOffset := Round(LN * (reMain.CurrAttr.Size * 1.5));
    end;
    end else begin
    moMacro.FindText(edFinder.Text, [frDown])
    end;
    end;

    Any assistance appreciated. Seems like it shold be a lot simpler than the way I am doing.

    THe code above gives error: Undeclared identifier 'Get. When replaceing with:

    WPRichText1.HeaderFooter.Get(wpIsHeader, wpraOnAllPages).RTFText.AsString;

    you receive the WPTools formatted text rather than the plain english text as you do when using wpRichEdit1.text

    I am doing a replacement of the plain text so I need the plain text from the header (and eventually footer)

    Thanks for your assistance.

    This is probably a simple thing but I am stuck on it. I want to return the text of a header or a footer. Just as you can get the text of the body by using:

    wpRichedit1.Text;

    I want to return similar for other letter sections so logically like:

    MyString := wpRichedit1.Header.text;

    I have been using:

    Fields[0].asString := WPRichText.BodyText.RTFText.asString;

    to save richtext to a database. But I now need to add headers and footers. This does not save that information. Is there a way to get teh Header, Body and Footer al from a similar call? This works well because it saves images in teh richtext as wellas the text. Will need to do the same with all regions.