Force a bullet style when pasting bullets

  • Hello,

    When a user copy-pastes a bullet list from Word into a WPRichText, I would like the bullet style to be forced to the small black circle (Wingdings character " l ").

    For this I changed the function :

    Zitat

    WPIOReadRTF.pas - procedure TWPRTFReader.CloseDestination(CurrentDest, NewDest: TWPRDS);

    I changed the following code :

    Code
    { previous code }
    {FCurrentList.CurrentStyle.ASet(
      WPAT_NumberTEXT, FCurrentList.CurrentStyle.AStringToNumber(
      FCurrentNumberString));}
    
    
    { new code }
    FCurrentList.CurrentStyle.ASet(WPAT_NumberTEXT, 1) ; //forcing bullet #1
    FCurrentList.CurrentStyle.ASet(WPAT_CharFONT, 1) ; //forcing font #1 = Wingdings

    The bullet is correctly set to #1 (which is the caracter "l" in the FAllStrings list), but the font is not set to #1 (which is the font "WingDings" in the FFonts list).

    I did not find why the font is not correctly applied, do you have any suggestion ? Thank you !

  • Hello Julian,

    Thanks for the tip, I updated my code based on your remark :

    Code
    { previous code } 
    {FCurrentList.CurrentStyle.ASet( 
      WPAT_NumberTEXT, FCurrentList.CurrentStyle.AStringToNumber( 
      FCurrentNumberString));} 
    
    
    { new code } 
    FCurrentList.CurrentStyle.ASet(WPAT_NumberTEXT, 1) ; //forcing bullet #1 
    FCurrentList.CurrentStyle.ASet(WPAT_CharFONT, FRTFProps.AddFontName('Wingdings')) ; //forcing font Wingdings

    Now :
    - When copying "standard" bullets from Word, it works fine
    - When copying "images" bullets from Word, it still uses font 'Symbol' instead of 'Wingdings'.

    The image belows shows this difference :


    I had a deep look into the code but couldn't find how to solve this. Any additional tip ? Thanks for your help !