trichview.com

trichview.support




Re: Reconstructing a textstyle


Return to index


Author

Message

shmp

Posted: 02/14/2003 5:26:30


This is just a cut-and-paste but it will give you the idea.


  RVStyle1.TextStyles.Clear; //Warning! Styles and ParaStyles is cleared.

  RVStyle1.ParaStyles.Clear;

  for count := 0 to 2 do begin

    case count of

    0:begin

        RVStyle1.TextStyles.Add;

        RVStyle1.TextStyles[0].Charset := ANSI_CHARSET;

        RVStyle1.TextStyles[0].FontName := 'Arial';

        RVStyle1.TextStyles[0].Color := clBlack;

        RVStyle1.TextStyles[0].BackColor := clNone;

        RVStyle1.TextStyles[0].HoverBackColor := clNone;

        RVStyle1.TextStyles[0].HoverColor := clNone;

        RVStyle1.TextStyles[0].Protection := []; //most has default settings

and you do not need to reset it. Only a sample here.

        RVStyle1.TextStyles[0].Style := [];

        RVStyle1.TextStyles[0].VShift := 0;

        RVStyle1.TextStyles[0].Size := 11;

        RVStyle1.TextStyles[0].Standard := True;

        RVStyle1.TextStyles[0].Jump := False;

        RVStyle1.TextStyles[0].JumpCursor := crDefault;

        RVStyle1.TextStyles[0].StyleName := 'Normal';

        RVStyle1.TextStyles[0].Unicode := False;


        RVStyle1.ParaStyles.Add;

        RVStyle1.ParaStyles[0].Alignment := rvaLeft;

        RVStyle1.ParaStyles[0].FirstIndent := 0;

        RVStyle1.ParaStyles[0].LeftIndent := 0;

        RVStyle1.ParaStyles[0].RightIndent := 0;

        RVStyle1.ParaStyles[0].Standard := True;

        RVStyle1.ParaStyles[0].StyleName := 'Left';

        RVStyle1.ParaStyles[0].BiDiMode := rvbdLeftToRight;

        FormatIndent(0); //This is a subroutine not included with this paste


        RVStyle1.ListStyles[1].Levels[0].ImageList := BulletsX; //You should

have created your image list

        RVStyle1.ListStyles[1].Levels[0].ListType := rvlstImageList;

        RVStyle1.ListStyles[1].Levels[0].FirstIndent := 0;

        RVStyle1.ListStyles[1].Levels[0].LeftIndent := 30;

        RVStyle1.ListStyles[1].Levels[0].MarkerIndent := 15;

        RVStyle1.ListStyles[1].Levels[0].ImageIndex := 8;


      end;

    1:begin

        RVStyle1.TextStyles.Add;

        RVStyle1.TextStyles[1].Charset := ANSI_CHARSET;

        RVStyle1.TextStyles[1].FontName := 'Arial';

        RVStyle1.TextStyles[1].Color := 0;

        RVStyle1.TextStyles[1].BackColor := clNone;

        RVStyle1.TextStyles[1].HoverBackColor := clNone;

        RVStyle1.TextStyles[1].HoverColor := clNone;

        RVStyle1.TextStyles[1].Protection := [];

        RVStyle1.TextStyles[1].Style := [];

        RVStyle1.TextStyles[1].VShift := -50;

        RVStyle1.TextStyles[1].Size := 7;

        RVStyle1.TextStyles[1].Standard := True;

        RVStyle1.TextStyles[1].Jump := False;

        RVStyle1.TextStyles[1].JumpCursor := crDefault;

        RVStyle1.TextStyles[1].StyleName := 'Subscript';

        RVStyle1.TextStyles[1].Unicode := False;


        RVStyle1.ParaStyles.Add;

        RVStyle1.ParaStyles[1].Alignment := rvaCenter;

        RVStyle1.ParaStyles[1].FirstIndent := 0;

        RVStyle1.ParaStyles[1].LeftIndent := 0;

        RVStyle1.ParaStyles[1].RightIndent := 0;

        RVStyle1.ParaStyles[1].Standard := True;

        RVStyle1.ParaStyles[1].StyleName := 'Centered';

        RVStyle1.ParaStyles[1].BiDiMode := rvbdLeftToRight; //good for

unicode

        FormatIndent(1); //This is a subroutine not included with this paste


        RVStyle1.ListStyles[1].Levels[1].ImageList := BulletsX;

        RVStyle1.ListStyles[1].Levels[1].ListType := rvlstImageList;

        RVStyle1.ListStyles[1].Levels[1].FirstIndent := 0;

        RVStyle1.ListStyles[1].Levels[1].LeftIndent := 45;

        RVStyle1.ListStyles[1].Levels[1].MarkerIndent := 30;

        RVStyle1.ListStyles[1].Levels[1].ImageIndex := 9;

      end;

    2:begin

        RVStyle1.TextStyles.Add;

        RVStyle1.TextStyles[2].Charset := ANSI_CHARSET;

        RVStyle1.TextStyles[2].FontName := 'Arial';

        RVStyle1.TextStyles[2].Color := clBlack;

        RVStyle1.TextStyles[2].BackColor := clNone;

        RVStyle1.TextStyles[2].HoverBackColor := clNone;

        RVStyle1.TextStyles[2].HoverColor := clNone;

        RVStyle1.TextStyles[2].Protection := [];

        RVStyle1.TextStyles[2].Style := [fsBold]; //set style to bold

        RVStyle1.TextStyles[2].Size := 11;

        RVStyle1.TextStyles[2].Standard := True;

        RVStyle1.TextStyles[2].Jump := False;

        RVStyle1.TextStyles[2].StyleName := 'Normal2'; //New StyleName

        RVStyle1.TextStyles[2].Unicode := False;


        RVStyle1.ParaStyles.Add;

        RVStyle1.ParaStyles[2].Alignment := rvaRight;

        RVStyle1.ParaStyles[2].FirstIndent := 0;

        RVStyle1.ParaStyles[2].LeftIndent := 0;

        RVStyle1.ParaStyles[2].RightIndent := 0;

        RVStyle1.ParaStyles[2].Standard := True;

        RVStyle1.ParaStyles[2].StyleName := 'Right';

        RVStyle1.ParaStyles[2].BiDiMode := rvbdLeftToRight;

        FormatIndent(2); //This is a subroutine not included with this paste


        RVStyle1.ListStyles[1].Levels[2].ImageList := BulletsX;

        RVStyle1.ListStyles[1].Levels[2].ListType := rvlstImageList;

        RVStyle1.ListStyles[1].Levels[2].FirstIndent := 0;

        RVStyle1.ListStyles[1].Levels[2].LeftIndent := 60;

        RVStyle1.ListStyles[1].Levels[2].MarkerIndent := 45;

        RVStyle1.ListStyles[1].Levels[2].ImageIndex := 10;

      end;

    end;

The sample above not only add new text styles but also add ParaStyles and

ListStyles. From the lines above, you get the idea that this method is

called only when you create a new document because styles are cleared and

then added.


>

> Hello again,

> How can I take a currently available textstyle and re-construct it with

new

> properties. Say, if I have a textstyle named 'normal' and I want to create

> a new textstyle from 'normal' and named it as 'normal2'. In 'normal2' I

want

> the text to be BOLD and text color to be clRed.

>

> 1. How do I create this 'normal2'?

> 2. How do I add by renaming to the RVStyle Textstyle?

>

> Thanks.

>

> P.s.

> I have to test it thoroughly before I make a purchase.





Powered by ABC Amber Outlook Express Converter