Beiträge von Stef Merlijn

    Hi Julian,

    Code
    WPTRichText1.ColorDesktop := clRed;


    In WPTools 5 this only changed the background of the paper into red (in wplayLayout). Even when the control didn't have the focus.

    In WPTools 6 the color of the background and the paper are both changed into red (in wplayLayout) when it doesn't have the focus. When it has focus only the background is red.

    Is this changed for some reason of is it a bug?

    Regards,
    Stef

    Hi,

    My application uses a TWPRichText (no TWPDBRichText).
    I store the content of a RichText into a database.

    I load the content from the database into the WPRichText, like:

    Code
    WPRichText.LoadFromString(MyQuery.FieldByName('Content').AsString);


    After that I'll check if the text is loaded:

    Code
    If WPRichText.IsEmpty then
      ShowMessage('Content is empty...');


    This always returns True (even though the content is correctly loaded into the editor).

    Can you direct me in the right way, on how to update the editor somehow so it recognizes the content?

    Thanks, Stef

    Adding the wpsec_ResetPageNumber to the select didn't do it:

    Code
    Section.Select := [wpsec_ResetPageNumber,wpsec_PageSize,wpsec_Margins,wpsec_ResetOutlineNums];

    Pagenumbers are still numbers as:
    Document for customer A: Page 1 of 4, Page 2 of 4
    Document for customer B: Page 3 of 4, Page 4 of 4

    Do you have any idea why it is not working?

    Regards,
    Stef

    Hi,

    For the first part of your question the following code might be useful for you. It's not exactly what you want but very close I believe:

    Question 3 and 4 are solved. I use following code to accomplish it:

    Code
    begin
      // Add horizontal line at the top of the footer
      par:=MailingEditor.HeaderFooter.Get(wpFooter,wpraOnAllPages).FirstPar;
      par.ASet(WPAT_BorderFlags, WPBRD_DRAW_Top);  // Top
      par.ASet(WPAT_BorderWidth, WPCentimeterToTwips(0.02)); // 0,5 mm
      par.ASetColor(WPAT_BorderColorT, clBlack); // Black line
    end;

    Please have a look at question 1 and 2.
    Regards,
    Stef

    Hi,

    When I add pagenumbers into a mailmerge document, like:

    Code
    par.Insert(0, 'Page: '), txtplain);          par.InsertNewObject(maxint, wpobjTextObject, false, false, txtplain).Name := WPTextFieldNames[wpoPageNumber];          par.Insert(maxint,  ' of ', txtplain);          par.InsertNewObject(maxint, wpobjTextObject, false, false, txtplain).Name := WPTextFieldNames[wpoNumPages];


    Then the pages are counted and numbered for all the generated pages (regardless of the customer). The mergedocument is merged into one new document.

    Is there a way to number the pages for each customer. Like:
    Document for customer A: Page 1 of 2, Page 2 of 2
    Document for customer B: Page 1 of 2, Page 2 of 2

    Maybe there is a way to transform "wpoPageNumber" and "wpoNumPages" into the actual numbers the moment the document is merged. See basically your code from Mail4-project below:

    Thanks, Stef

    Hi,

    When I add an image into the header I mark it with a bookmark.
    Before I add the image a second time I need to know if it was already added and therefor I check if the bookmark is still there (if not: it will be created).
    Here is my problem.
    It seems the bookmark can't be found in the Header. It is recreated each and every time. How can I check if the image is added to the header and if it's still there (bookmark isn't empty)?
    * The same situation applies for added bookmarks (with text in it) in the footer, so please keep that in mind when answering this question.

    With kind regards,
    Stef

    Code
    if (DM.TEigenBedrijf.FieldByName('Logo').IsBlob) and (not(DM.TEigenBedrijf.FieldByName('Logo').IsNull)) then          begin            try              // Prepare Streams              TempImageFile := ExtractFilePath(Application.ExeName)+'TempImage.jpg';              DM.TEigenBedrijfLogo.SaveToFile(TempImageFile);              MyBlobStream := TMemoryStream.Create;              MyBlobStream.LoadFromFile(TempImageFile);  // as demo              wpImgObj.LoadFromStream(MyBlobStream);              wpImgObj.WidthTW := wpImgObj.ContentsWidth;              wpImgObj.HeightTW := wpImgObj.ContentsHeight;              MailingEditor.HeaderFooter.Get(wpIsHeader, wpraOnAllPages, '').WorkOnText := true;              If BookmarkAanmaken('KoptekstLogo') then              begin                with MailingEditor.TextObjects.Insert(wpImgObj) do                begin                  PositionMode := wpotPar;                  RelX := (MailingEditor.Header.PageWidth - 2600);                end;                MailingEditor.CPMoveNext; // Plaats de cursor buiten de bookmark              end;            finally              MyBlobStream.Free;              if FileExists(TempImageFile) then                DeleteFile(TempImageFile);            end;          end;

    Hi,

    Question 1:
    I would like to add a line to the WPRichText in the current place in the document (body, header, footer).
    This line must exactly fit between the margins that are set by the horizontal ruler of the WPRichText.

    Question 2:
    I would like to be able to select an inserted line and change the width, height and position in the document. Can this be done?

    Question 3:
    How to get a line at the top of the footer so it remains there even is text is added to the footer?

    Question 4:
    How to get a line at the bottom of the header so it remains there even is text is added to the header?

    For adding a line I use following code, maybe this isn't the right code in every situation.

    Code
    with MailingEditor.TextObjects.InsertNewObject(wpobjHorizontalLine, false, false) do
    begin
      width  := WPCentimeterToTwips(MailingEditor.Width);
      Height := 1;
      iParam := clBlack;
    end;
    MailingEditor.Refresh;

    Thanks,
    Stef