Creating an Office 2003 style Word Processor

  • I have just purchased WPTools to replace Word in our application. We need a solution that is much more tightly bound into our system than we can achieve with Word. Also controlling word through COM is somewhat restrictive.

    To help our users adjust, we want to make our solution as 'Word Like' as possible. We have used the excellent TMS Component Pack to create Office 2003 style toolbars and have now achieved a good match at the GUI level. We are now working through each of the functions to ensure that they work in a similar way to Word.

    Our first problem is that the Font and FontSize combo boxes do not function as expected. If nothing is selected they show the specific attributes of the character immediately to the right of the cursor. This is OK if the character has a typeface and size attribute. However if no specific attributes have been set (ie the character defaults to the paragraph’s style values) then the boxes are left blank. This is different to the way Word works and a little quirky from a user’s perspective. We would like the combo boxes to always show the implied attributes for the character rather than the set attributes – ie the actual font and size which will be used to render the character.

    Is this possible?

  • Just exporting to RFT within word for now which is OK for testing purposes but a bit labour intensive and possibly not 100% accurate. I have had a quick play with the WPWordConv unit, but with not much success.

    Will probably write some stuff to batch export existing documents to RTF and then import them into WPTools + patch up as we go. This still leaves the problem of customers wanting to import word documents from 3rd parties hmm. I must admit, I rather assumed that WPTools would do this anyway.

    • Offizieller Beitrag

    Hi,

    >>Our first problem is that the Font and FontSize combo boxes do not function as expected. If nothing is selected they show the specific attributes of the character immediately to the right of the cursor. This is OK if the character has a typeface and size attribute. However if no specific attributes have been set (ie the character defaults to the paragraph’s style values) then the boxes are left blank. This is different to the way Word works and a little quirky from a user’s perspective. We would like the combo boxes to always show the implied attributes for the character rather than the set attributes – ie the actual font and size which will be used to render the character. <<

    This question came up before in contect with DevExpress toolbars. The provided implementation which uses TBX already offers this kind of behavior. The latest release also has been modified to work better when part of the selected text use the default attribute (have undefined font setting)

    The code which updates the combo is basically:

    Code
    if Edit.IsSelected then              begin                if not Edit.SelectedTextAttr.GetFontName(fnt) then                  TTBXComboBoxItem(FAttachedControl).Text := ''                else TTBXComboBoxItem(FAttachedControl).Text := fnt;              end else TTBXComboBoxItem(FAttachedControl).Text := edit.CurrAttr.FontName;

    for font size it is

    Code
    if Edit.IsSelected then //V5.19.5
                begin
                   if not Edit.SelectedTextAttr.GetFontSize(aSize) then
                      TTBXComboBoxItem(FAttachedControl).Text := ''
                    else TTBXComboBoxItem(FAttachedControl).Text := FloatToStr(aSize);
                end else
                if edit.CurrAttr.Size = 0 then
                  TTBXComboBoxItem(FAttachedControl).Text := ''
                else TTBXComboBoxItem(FAttachedControl).Text :=
                  FloatToStr(edit.CurrAttr.Size);

    Julian