Beiträge von Robert van Hoornaar

    Hi there,

    Is there anybody who also has had problems with Windows 2000 and 2003 terminal server in combination with TWPRichText?

    I use Tframes on which I have a TWPRichText component. When I run it normally then I got no problem.

    As soon as I start running it under TS I get AV's in ntdll.dll as soon as I start selecting block of text.

    I am not yet sure where the problem exactly is. I will look further but if anybody has an idea, it will be welcome.

    Julian,

    I am not sure but i think the beahviour of the MergeCell has changed.

    When I now merge 2 cells in a table, the second cell is now placed below the first cell and the complete rowheight is increased.

    I created a small test project with the next code:

    I would like to have the rowheight to be in the original state. How do I do that?

    Thanks in advance

    Robert


    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, WPRTEDefs, WPCTRMemo, WPCTRRich;

    type
    TForm1 = class(TForm)
    WPRichText1: TWPRichText;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    procedure formatcell(arow,acol:integer;par:TParagraph);
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    var tblpar : TParagraph;
    begin
    tblpar := WPRichText1.TableAdd(4,4, [wptblActivateBorders],nil,formatcell);
    // this merges with the next!
    tblpar.Rows[1].Cols[0].MergeCell;
    tblpar.Rows[1].Cols[0].ASet(WPAT_COLWIDTH, WPCentimeterToTwips(6));
    end;

    procedure TForm1.formatcell(arow, acol: integer; par: TParagraph);
    begin
    par.SetText('col='+inttostr(acol) + ' row='+inttostr(arow));
    end;


    end.

    Julian,

    I got it working now.

    When applying a Refresh of the RichtText component before calling the CreateTableOfContent the pagenumbers are changed.

    However without adding the line

    ActiveParagraph.Append(IntToStr(bobj.parentpar.Pagenr));

    on linenr 6768 of the WPCRTMemo.pas nothing is shown.

    Robert van Hoornaar

    Julian

    I tried adding a page number to the TableOfContents routine with

    ActiveParagraph.Append(#9);
    ActiveParagraph.Append(IntToStr(bobj.parentpar.Pagenr));

    ActiveParagraph.TabstopAdd(Header.PageWidth -
    Header.LeftMargin - Header.RightMargin - 36, tkRight, tkDots);
    ActiveParagraph.AppendNewObject(wpobjReference).Name := bobj.Name;

    However then pagenr is always 0.

    I really need the pagenumbering in the TOC.

    Can you help me?

    Robert van Hoornaar

    PS. The GlobalStyle demo does not work (anymore) with the new engine (5.10.9)
    I downloaded the new VCL demo's but there is no GlobalStyle example anymore.

    When generating heading outline styles and producing a TOC, the page numers are not displayed in the list. When exporting to rtf, fieldbookmark errors are shown in the TOC list (in Word).

    I following the follwing procedure to create the TOC

    First create a style voor the chapters:

    sty := RTFDoc.Memo.RTFData.RTFProps.NumberStyles.AddOutlineStyle(1,1);


    with RTFDoc.ParStyles.AddStyle('heading') do
    begin
    ASetAddCharStyle(WPSTY_BOLD);
    Aset(WPAT_CharFontSize,13 * 100);
    ASet(WPAT_IndentLeft, 32);
    ASet(WPAT_IndentRight, 32);
    ASet(WPAT_NumberSTYLE,sty.Number);
    ASet(WPAT_NumberLevel,sty.LevelInGroup);
    ASet(WPAT_ParIsOutline,1);
    end;

    And applying some text with the style:

    par.ABaseStyleName := 'heading';

    par.SetText(' A line of text');


    and generating the TOC:

    RTFDoc.BookmarkInput('TOC');

    and updating the TOC:

    procedure TRTFReport.UpdateTableOfContents;
    var
    a: TAttr;
    begin
    // ga naar het gemarkeerde punt voor de Inhoudsopgave
    RTFDoc.BookmarkMoveTo('TOC');
    a:= RTFDoc.Attr;
    a.Size:= 12;
    a.Style:= [afsBold];
    RTFDoc.Attr:= a;
    RTFDoc.CreateTableOfContents('TOC','_toc',[wptocUseParIsOutline,wptocCreateOutlineBookmarks],nil,'Inhoudsopgave');
    end;

    I have a little problem of setting the pagenumbers in the footer.

    I would like to have a footer looking like this:

    Blok 1(left alligned) Blok 2 (right aligned)
    Blok3(left aligned) Blok 4 (right aligned)

    Here Blok 3 is page numbering (# of ##)

    Blok 1 and Blok 3 need to be in a smaller font.

    I tried the code below but it produces this:

    # ##
    Blok1
    Blok2
    Blok3
    of


    So it produces 5 lines instead of 2 with the numbers of the pages on the first line.

    Anybody?


    procedure TFreeReportRTF.CreateFooter;
    var
    par : TParagraph;
    txt1, txt2 : TWPCharAttr;
    begin
    inherited;
    RTFDoc.ActiveText := RTFDoc.HeaderFooter.Get(wpIsFooter, wpraOnAllPages);
    RTFDoc.ASet(WPAT_BorderFlags, WPBRD_DRaw_top);

    FillChar(txt1,SizeOf(txt1),0);
    RTFDoc.ActiveText.RTFProps.AttrInterface.SetFontSize(txt1,8);

    FillChar(txt2,SizeOf(txt2),0);
    RTFDoc.ActiveText.RTFProps.AttrInterface.SetFontSize(txt1,10);

    //blok 1
    par := rtfdoc.ActiveText.AppendPar();
    par.align := paralLeft;
    par.Insert( maxint,'Blok1',txt1);

    //blok 2
    par := rtfdoc.ActiveText.AppendPar();
    par.align := paralRight;
    par.insert(maxint,'Blok 2',txt2);

    //blok 3
    par := rtfdoc.ActiveText.AppendPar();
    par.align := paralLeft;
    par.Insert( maxint,'Blok 3',txt1);
    par := rtfdoc.ActiveText.AppendPar();

    //blok 4
    par := rtfdoc.ActiveText.AppendPar();
    par.align := paralRight;
    par.Insert( maxint,'Pagina ',txt2);
    RTFDoc.InputTextField(wpoPageNumber);
    par.Insert( maxint,' van ',txt2);
    RTFDoc.InputTextField(wpoNumPages);


    RTFDoc.ActiveText := RTFDoc.BodyText;
    end;