Beiträge von support

    >> I wish to dynamically set stored view options.

    Since it is a property you need to use
    ViewOptions := ViewOptions + [ wpshowcr ];

    In C++Builder it should look like
    ViewOptions = ViewOptions << wpshowcr;

    Q: I need to repeat one row in a letter which contains merge fields N times to add data from a query.

    A: You can use this procedure. It locates the first row by searching for the text "repeatrow".

    How I can convert .rtf file to .pdf format with WPTools for Delphi ?

    You need the products WPTools and wPDF:
    place a TWPRichText on the form (from WPTools)
    and a TWPPDFExport (from wPDF)

    Set the property
    WPPDFExport1.Source := WPRichText1;

    and convert the file like this:
    WPRichText1.LoadFromFile( filename );
    WPPDFExport1.FileName :=
    ChangeFileExt(WPRichtext1.LastFileName,'.PDF');
    WPPDFExport1.Print;

    The best is to use the TWPRichText with the AsString property:

    Code
    Field.AsString := WPRichText1.AsString;
    
    
    WPRichText1.AsString := Field.AsString;

    Of course the DBWPRichText can be used, too, but it will likely post the data more often that if you do it manually and is so discouraged with client server systems.

    Create different header and footer as 'named' text:

    Code
    // Generate simplyfied header and footer  WPRichText1.HeaderFooter.Get(wpIsHeader, wpraNamed, 'ONE').RtfText.AsString :=    'Dies ist der Header ONE';  WPRichText1.HeaderFooter.Get(wpIsHeader, wpraNamed, 'TWO').RtfText.AsString :=    'Dies ist der Header TWO';  WPRichText1.HeaderFooter.Get(wpIsHeader, wpraNamed, 'THREE').RtfText.AsString :=    'Dies ist der Header THREE';  WPRichText1.HeaderFooter.Get(wpIsFooter, wpraNamed, 'ONE').RtfText.AsString :=    'Dies ist der Footer ONE';  WPRichText1.HeaderFooter.Get(wpIsFooter, wpraNamed, 'TWO').RtfText.AsString :=    'Dies ist der Footer TWO';  WPRichText1.HeaderFooter.Get(wpIsFooter, wpraNamed, 'THREE').RtfText.AsString :=    'Dies ist der Footer THREE';

    In the event WPRichText1GetSpecialText you can activate one of the above texts using this code:

    Code
    if WPFindTxtOnPage(WPRichText1,par,lin,'ONE',true) then  begin     SpecialText := WPRichText1.HeaderFooter.Get(Kind, wpraNamed, 'ONE');  end  else if WPFindTxtOnPage(WPRichText1,par,lin,'TWO',true) then  begin     SpecialText := WPRichText1.HeaderFooter.Get(Kind, wpraNamed, 'TWO');  end ..

    The code above uses an utility function which checks if a certain text exists within one line on a certain page. If 'scan=true' it finds the text anywher in the line, otherwise only at the start.

    NOTE: This unit will be in V4.2a and higher (unit WPRich.PAS)

    Zitat

    I'd like to have the ability to insert an open or checked box for boolean field values. Is it possible to specify formatting with OnMailMergeGetText?


    You have access to the current writing attribute through
    Contents.pMergeAttr^
    There you can set the font (GetFontNr!), Color etc.

    Using different StringValues for true/false you can draw checkboxes using the WingDing font:

    Code
    if inspname='TRUE' then
     begin
       Contents.pMergeAttr^.Font := WPRichText1.GetFontNr('WingDings');
       Contents.StringValue := #253;
     end else if inspname='FALSE' then
     begin
       Contents.pMergeAttr^.Font := WPRichText1.GetFontNr('WingDings');
       Contents.StringValue := #111;
     end;

    WPExtObj etc belong to WPTools Standard. See the directory \Dx

    To insert hidden text use
    CurrAttr.AddStyle([afsHidden]);
    InputString('@@MARK@@');

    To find use
    if Finder.Next('@@MARK@@') then
    CPPosition := Finder.FoundPosition;

    >> Bullets disappear or are not correctly displayed in the wptolls componenet integrated in report builder.

    I suggest to add one line in unit ppWPTools:
    Result.Header.LoadOptions :=
    Result.Header.LoadOptions + [loOnlyListText];

    That has to go into function GenerateNewRichText at the end.

    Julian

    Zitat

    It appears that what I really need to do is default to having the IgnorePageHeight property set to true...

    I don't understand - Do you need to have the group placed on one page and not seperated?
    If the group is just a table then the easiest is to use the switch DontBreakTables in the FormatOptions. If it is text I usggest to use the paprKeepN property. That will be applied to bands which use the option wppKeepControl. (see WPMerge.PAS, line 4438)

    Julian

    There is never 'one bookmark' - this are always two - using BookMarkTextAttr.Hidden hides the text between them. Bookmarks (the code objects) usually are hidden - you can make them visible in property ViewOptions.

    For what you need using bookmarks is overkill. You could do something like
    CurrAttr.AddStyle([afsHidden]);
    WPRichText1.InputString('@@CP@@');
    CurrAttr.DeleteStyle([afsHidden]);

    and delete the next using Finder.Next('@@CP@@')
    , FoundText := ''
    after you loaded the document.

    or, much better, and much easier to
    before save:

    Code
    WPRichText1.RTFVariables.Strings['CursorPos'] :=   IntToStr(WPRichText1.CPPosition);


    after load:

    Code
    WPRichText1.CPPosition := 
      StrToIntDef( WPRichText1.RTFVariables.Strings['CursorPos'],0);


    Please note that WPTools can save and load the selection markers without any additional code - see Header.StoreOptions.

    Julian

    Two possible solutions:

    a) in WPMerge.PAS, remove the comment so line 2267 reads

    if FCheckTheHeight and FMustFitCompletely or (paprIsTable in par^.prop) then

    b) Use the property
    IgnorePageHeight - this of course will not create individual pages so it depends on the way you use WPReporter if it makes sense for you or not.

    Since IgnorePageHeight let the RTF engine apply the page breaks it is usually the most reliable setting which is possible.

    Julian Ziersch