Header.DefaultTabStop setting is not working consistently

  • Delphi 2007. WPTools v.5.51, Windows Vista

    To change Indent (next level/prior level) and TabStop, I have this simple wrapper function that I call from user interface (menu item).

    Code
    Procedure WPT_Set_TabStop(RTFMemo : TWPCustomRtfEdit; nTwips: Integer);
    begin
        RTFMemo.Header.DefaultTabStop := nTwips;  {Tab Stop}
    end ;

    Problem:
    Setting a different value for Header.DefaultTabStop (e.g., from 360 to 720 twips) does NOT seem to work consistently (at times it seems to work as expected, at other times, TabStop value does not change at all).

    Is there another property that may be interfering or do I need to call some code to make this property take effect?

    Note: When application starts, I am initializing page margins and default tab stop. This, of course, does not help the existing documents that already have the header info saved in file. So, I am trying to over-ride old header info in code as noted above.

    I DO have to work with EXISTING documents (no choice) that need page margin and indents adjusted. So, I am trying to apply page margins (works fine) and default tab stop (not working fine :( ) to existing documents via menu items AFTER loading the document.

    (To actually increase or decrease paragraph indent level, use code copied from: WPCtrRich...WPI_CO_NextLevel and WPI_CO_PriorLevel...from button.OnClick(). This works as expected.)

    Thank You

    JayM

  • Adding comments to my post: One would assume there is ONLY ONE header.DefaultTabStop setting that applies to the entire document. Not so.
    For example, I have a document with DefaultTabStop set to 720. I copy/merge a few paragraphs from another document that has DefaultTabStop set to 1440. In this case, the old and the newly added paragraphs keep their original TabStop/Indent value.

    Further, selecting all text and chaning DefaultTabStop value does NOT change the entire document to the new setting. Each paragraph STILL keeps its old DefaultTabStop setting as noted above.

    I wonder if there is a paragraph level property that is controlling/affecting this behavior.

    Thanks

    JayM

    • Offizieller Beitrag

    Hi,

    header.DefaultTabStop is the source for this value. If you copy paragraphs they cannot use a different value, unless they are somehow linked to the old data collection which should not be the case.

    Thats a pretty silly code,

    Code
    for i:=1000 to 3000 do
      begin
        WPRichText1.Header.DefaultTabstop := i;
        WPRichText1.ReformatAll(true,true);
        WPRichText1.Repaint;
        Sleep(10);
      end;

    But I used it to test the DefaultTabstop behavior.

    Maybe you have fixed tabstops in the copied text - then you need to clear those.

    TParagraph.TabstopClear;

  • Thank you very much.

    I executed "TParagraph.TabstopClear" for each paragraph in the document in a loop and it works !!!

    I can't explain how this property got set in the first place (I did not set it because I did not even know it existed). May be this is something that "just happens..."

    Thanks again.