Beiträge von Antti Kurenniemi

    Hi all.

    I'm trying to set styles in code for an edit. I've managed to *almost* set the initial style like this:

    Setting the ActivePar.ABaseStyle seems necessary, otherwise on an empty editor the first paragraph is not using that style, only the following ones.

    Anyway, my problem is that the font is not Times New Roman in the editor. Color is red and the style dropdown correctly shows "Test style" as the selected style, but it is using Arial font.

    Maybe I need to set the DefaultAttr or something like that? Btw, I've noticed that DefaultAttr doesn't work (or probably I don't use it correctly), instead I have to use WritingAttr to affect the defaults.

    Is there a complete sample of something along the lines of setting styles in code and assigning the default one? Lots of pieces of information in the docs and this forum, but I'm still a bit lost...


    TIA,
    Antti Kurenniemi

    Hey ho.

    I'm inserting a footer with page numbering as "Page x / y" where x is current page number and y total page count. I do it something like this:

    Code
    par.Insert(0, 'Page ', txtplain);
    par.InsertNewObject(maxint, wpobjTextObject, false, false, txtplain).Name := WPTextFieldNames[wpoPageNumber];
    
    
    par.Insert(maxint, ' / ', txtplain);
    par.InsertNewObject(maxint, wpobjTextObject, false, false, txtplain).Name := WPTextFieldNames[wpoSectionNumPages];

    It works, but the [wpoSectionNumPages] part is formatted not very nice, the numbers overlap. The [wpoPageNumber] is ok. Here's how it looks:

    [Blockierte Grafik: http://www.bluerose.fi/footerpagenumber.png]

    ("Sivu" is Finnish for "Page") It's showing page 15 / 15, and the first 15 is just fine but the second one is not.

    I haven't tried to fiddle with it much yet, so maybe I'm overlooking something obvious here?

    TIA,
    Antti Kurenniemi[/img]

    Thanks for your tips; unfortunately I still can't get this to work. I changed the dynamically created editor to be a TWPCustomRTFEdit, created using CreateDynamic, and that + the visual editor to which the combined document is created in are both using the same OnInitializeRTFDataObject event and are assigned the same TWPRTFProps object.

    Bullets are still lost.

    Am I doing this somehow wrong? My goal is to combine multiple (typically 50 - 100) smaller documents into one big document, and naturally I'd want all the formatting preserved. The smaller ones are created within my app, in WPRTFEdits and stored into a database.

    Is there some other way I could approach this maybe?

    Hi Julian,


    thanks, but still no go; it works as long as all the editors are inserted on the form at design time, but not if I create one at runtime, then it just messes the formatting. It actually now fails differently: the bullets are there, but bold text "leaks", i.e. everything after a single bold line is still bold.

    This is the whole unit I have, nothing else:

    If I change the line TempEditor.AsString to TempEditor.FastAppendText(Editor2) (obviously clear it first), then it works, but like I said I need to read the content from a database so I cannot do that.

    I have further information about this. Seems the problem comes from where I load the editor content from the database. I load it from a Blob field and assign it to my "temp" editor (non-visual, created dynamically) using AsString - after this the formatting is wrong.

    I tested assigning the text to the "temp" editor using FastAppendText, and then from there on to the "master" editor, and that worked just fine.

    So now the problem is that I need to load the content from a database and assign it to a temp editor, after which the styles formatting is lost.

    The whole thing is like this:


    There are Editor1 and Editor2, both containing a small piece of text with a bulleted list. Editor3 is empty at design time, and these two are merged into it. If I just do FastAppendText with both Editor1 and Editor2, it's ok, but not when the TempEditor is loaded from database using AsString.

    Any ideas? Sorry to nag on about this, but it's pretty important for me to get this working somehow.

    Hiya,


    thanks, I got a bit further now: it works correctly when all the editors involved are visual, created at design time, but not when there is an editor created dynamically at runtime (i.e. for reading the content from database).

    I added an OnInitializedRTFData event for the dynamically created edit as well, and have checked that it gets called. It is assigning the same WPGlobalRTFProps object as for the other (visual) editors which is created in the form create event.

    What should I do to create the editor dynamically? Right now (for this test anyway) I'm not doing anything except

    Code
    TempEditor := TWPRichText.Create(nil);TempEditor.OnInitializedRTFData := Initialize_Temp;

    And in the Initialize_Temp

    Code
    RTFPropsObject := WPGlobalRTFProps;

    I have an app in which I compose a "master" document from a bunch of smaller ones. All of these are WPTools documents. Composing the master document is done using FastAppendText.

    There is a problem that if any of the smaller docs contain bulleted lists, the bullets are lost, i.e. they do not appear in the master document. Numbered lists seem to be ok. The list text is seen as expected, but just the bullet marks are not visible.

    I already got advice from support to use the same RTFDataCollection for both (all) RTF engines, but I'm at loss how to do that, so I would appreciate a sample or any other "for dummies" level help.

    I'm currently using WPTools version 6.05.8 and Delphi 2007.


    TIA,
    Antti Kurenniemi

    Hi all.


    When I call SomeWPRichTextComponent.PrintDialog , I always get a "Printer selected is not valid" exception. I can print from other apps (word, notepad, delphi and so on), and have more than one printer (including PrimoPDF driver) and all of the work, just my own app doesn't.

    Anyone have any ideas what's up with that? This is a really annoying problem...


    TIA,
    Antti Kurenniemi