1st header line not kept if html is used as input&output

  • I am trying out if I can use WpTools 6 as simple wysiwyg html editor.
    Look at the following sample input file:

    Code
    <h1>Title 1 header</h1><p>This the first paragraph.</p><ul><li>Unordered list item 1</li><li>Unordered list item 2</li><li>Unordered list item 3</li><li>Unordered list item 4</li></ul><h2>Title 2 header</h2><p>Paragraph in title 2 </p><ol><li>Ordered list item 1</li><li>Ordered list item 2</li><li>Ordered list item 3</li></ol><a href='http://www.sitestepper.com' rel='external'>Website of Sitestepper</a>


    Loaded into WpTools with the line:

    Code
    wprt.LoadFromString( EasyEdit.EditSource.Strings.Text, 'HTML' );


    and back with the line:

    Code
    EasyEdit.Lines.Text := wprt.AsANSIString('HTML-OnlyHTMLBody,DontWriteFontParams,ignorefonts,nostyles,nocharstyles,nonumstyles');


    Produces the following html-code:


    Not too bad, but:

      The <h1> line is removed (while other <h2> lines are kept (if I put a paragraph above the <h1> line, the <h1> too is kept.

      A lot of code (font-size and margins) is added on the <p> <h2> and <ul>/<ol> lines.


    The <h1> which is removed is clearly a bug, no ?
    Is there a way to make sure no font and margin style parameters are added by WpTools.

  • Update: I found out myself how to delete the font-size and margin properties:

    I found no explanation on "ADelAllCharAttrDefinedIn();"

    Any more ideas or suggestions for better code would be appreciated ?

  • Just to keep my tests a bit documented.

    If I use

    Code
    par.ADel(WPAT_NumberSTYLE);


    The <ul>..</ul> and <ol>..</ol> lines are deleted (which is incorrect html syntax), of course.


    Anyway: I hope that Julien still can give a solution to the disappearing <h1> line ...

    And if anyone else is trying to use WpTools 6 as an html editor, please let me know. Maybe we can help each other ...

    • Offizieller Beitrag

    Hi,

    ADelAllCharAttrDefinedIn is used to remove the attributes which are redundant. Internalle it reoves the overriding character attributes. This function is necessary for support of paragraph styles.

    <h1> ... are currently not used, just the class=.... IF an only if a paragraph style is used for a paragraph.

    When YOu delete the paragraph attributes, You could also use AClear.

    Julian