• Hi,

    I've looked for a while at various RTF products and it seems this one will do what I need, but I'm still unsure how to do it.

    I have a QuickReport that works very well, except users have wanted to edit it, which is impossible (& exporting kills the formatting). I have all the data that built the report in numerous TStringLists. I built these TStringLists programmatically, and each is attached to a different QuickReport component - so like a heading or indented text. (This was more to appease QuickReport than anything else)

    So I have all this text that I created programmatically from inside of my program, and I want to put it into the body of a report that I've got. I've successfully imported the headers and footers but don't know where to go from here.

    I read through the documentation but am still very confused as to what gets called when and how I can attach my text into the body. Any help is appreciated. I'm also trying to work through some of the demos but again, I'm confused.

    Thanks.
    -Ben

  • So to clarify -

    All I want to use this for is to write out rich text to a form so the user can view it / print it/ save it (but not modify it inside the software).

    I have all the text prepared inside the software (not DB aware).

    I have also imported the headers and footers into a WPRichText.

    What I need to do is know how I can write my text line by line, each line with possible different formatting. And also how I can replace the variables I inserted into the RichText.

    The examples I found are all way too complex - that's all I need to figure out how to do. I'm going to replace my QuickReport Pro license with this license if I can figure out how to do it.

    And I'm doing it for the sole reason of being able to save my reports in rtf. My current reports are great, they just can't be accurately saved to rtf.

    Could someone point me in the direction of a very simple example that just inserts text and such?

    Thanks,
    -Ben

  • Seriously, this is very frustrating. The documentation is horrible and it has conflicting examples.

    I'm trying to figure out how to follow the numbering example and part of it says, "Note about CurrAttr: This is an interface which was introduced in WPTools 3. It is still supported and implemented in unit WPCTRRich. If you do not want to link unit WPCTRRich you cannot use CurrAttr. For new code we suggest to use ActiveParagraph, ASet or SelectTextAttr methods."

    Why is this in here then? As a new person reading the help documents I have no idea how to use these other methods, and the information is hard to find. I don't care how I use it, I just need to get it to work, and I find myself having to do trial and error on code that's hard to get ahold of!

    What's the deal with WPAT_*. I've been trying to use NumberSTYLE and NumberMODES and I can't get anything useful to come out.


    Why is there 5 different ways described how to do anything in the help. How am I supposed to make sense of any of this!

    Sorry, I'm just very frustrated trying to work through what should be a simple problem. All I need is to write text to an RTF file. And the text has numbering, etc....

    • Offizieller Beitrag

    Hi,

    numbering is not simple - it is one of the most complex parts of RTF. The reson is, that numbering can work like outlines (nested), there can be different outlines in a text (sections with outlines) and then there is the simple outline which stops at the first not numbered lines.

    WPTools 5 has been designed from scratch around a new architecture - that arichtectur is described in the manual (PDF). To take advantage of this, it is required to read about the datastructures.

    WPTools 5 (and 6) has several methods which make it compatible to code which was written for WPTools 4.

    There are 3 different ways to create text
    1) simulate the user typing - use CurrAttr and InputString
    2) similar to 1, but use the new WritingTextAttr, which, in contrast to "CurrAttr" also support undefined attributes
    3) work on paragraphs (use TParagraph object)

    To get started with your project "to write RTF text" check out the demo

    Demos/Tasks/CreateTable

    It uses the unit WPCreateDemoText.pas which contains examples on how to create formatted text.

    Code
    What's the deal with WPAT_*. I've been trying to use NumberSTYLE and NumberMODES and I can't get anything useful to come out.

    WPAT_* constants define properties. A TParagraph does not have a property like "Color", instead it is possible to read and write the property "Color" using the AGet and ASet methods. This is just the basics - there are AGetInherited to read a property which als can be inherited from a style or ASetColor to set a color value. Important is: The Read methods return a Boolean value. If this is FALSE this means, the property is not defined. This is the main reason to use Set/Get methods instead of a simple property as other components do.

    NumberSTYLE referes to an item in the collection NumberStyles - only the first 10 numbers have a fixed meaning. This is why it is required to use it like this:

    Regards

    • Offizieller Beitrag

    The very simple way to create text is this:

    Regards

    • Offizieller Beitrag

    More advanced (and intended) use of NumberStyle is this