We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML insert of <OL> or <UL> ignores formatting- goes to furthest margin regardless

TOOLS
=====
Running Aspose.Words v10.0.0.0 (and later converting to PDF with Aspose.PDF/PDFkit of course) – we have v11.9.0.0 if need be to update to.

ISSUE
=====
It appears that the limited HTML support and CSS styling support (e.g. via style="") works well except in the case of orderded and unordered lists – where they break out of any parent margin/padding/formatting/etc. (even Word document enforced left margins, etc!) and of course themselves do not adhere to any styling via the “style=” attribute on the containing

    or
    . Net result they slam to left side document default margin in all cases of HTML or Word formatting!

    As you can imagine, this is a bit of a deal breaker for document generation. Thoughts, newer release (newer than v10.0.0.0 in our case) possibly having addressed this issue?

    Thank you, love your products!

    ksDevGuy

Hi,


Thanks for your interest in Aspose.Words. Could you please attach your input Html file and the output Word/PDF document showing the undesired behaviour here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

Please see the attached example. I have included the source Word doc, the final output PDF with othe HTML ordered list breaking to the far left margin regardless of all attempts to contain it otherwise, and a snippet of the basic process we are following to inject the HTML into a field on the Word doc before PDF conversion.

In the “code.txt” file at the very top you will see a C# defined variable called “all_non_owned_aircraft_liability_exclude_rotorwing” this contains the HTML being inserted into a field on the page.

Any help would be appreciated of course per the original post above. Thanks!!

Hi,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 13.2.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7999. Your request has been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best regards,

Thank you, will await an update. Do you think it is a quicker or slower item (i.e. should we be building a generic routine to build Word native lists as the solution/fix might likely be many months away … or …)?

Thank you!

Hi,


Thanks for your inquiry. Unfortunately, this issue is not resolved yet. Our development team has completed the analysis of this issue. Rest assured, we will keep you informed of any developments and let you know once it is fixed.

Please note that you can not merge the formatting of an HTML fragment with formatting of a destination document directly by using the InsertHtml method. The method InsertHtml does not work this way; it uses only formatting of the HTML fragment and does not take destination formatting into account. The HTML fragment that is being inserted into a document should be formatted either before the insertion (by applying CSS styles to HTML elements) or after it (by setting DOM node properties).

Secondly, yes I would suggest you please create Lists in your document using Aspose.Words’ API:
http://www.aspose.com/docs/display/wordsnet/List+Class

Please let me know if I can be of any further assistance.

Best regards,

Thanks for the update.

As for your point about HTML formatting, we have tried to set ‘style=""’ attributes on the

    element to format it before insertion or wrap it in a containing
    with formatting (but it ignores all attempts to CSS format/style) – however, Aspose.Words does not support any CSS styling on
      /
      elements natively anyway (as a matter of fact, Aspose.Words only supports very limited CSS styling on selected HTML elements anyway from what we understand/experienced … unless we are misunderstanding something?)

      Thanks as ever.

Hi,


Thanks for your inquiry. Yes, you’re right; Aspose.Words currently does not support style attribute for OL and LI tags however we have already started working on the re-factoring of HTML Import. Your request has been linked to the appropriate issue (WORDSNET-7950) and you will be notified as soon as it is supported. Sorry for the inconvenience.

Best regards,
Hi,

It is to update you that our development team has completed the work on your issue (WORDSNET-7999) and has come to a conclusion that this issue and the undesired behaviour you're observing is actually not a bug in Aspose.Words. So, we've closed this issue as 'Not a Bug'. To achieve the desired results, you need to modify HTML fragment as follows:

string all_non_owned_aircraft_liability_exclude_rotorwing = "Non-Owned Aircraft Liability - It is agreed that, with respect to Coverages A, B and D in Section I of the policy, coverage will apply to any aircraft you use but which is not declared in Item 5 of the Declarations always provided that you have no interest in the aircraft as owner in whole or in part and exercise no part in the servicing or maintenance of the aircraft.

Our liability for losses under this coverage with respect to non-owned aircraft is subject to a limit of $non_owned_aircraft_liability_limit each occurrence with Passenger Liability limited to $non_owned_aircraft_liability_sublimit.

No coverage hereunder applies:
  • To liability arising out of any product you manufacture, sell, handle or distribute.
  • To any Aircraft having seating capacity exceeding $aircraft_seats seats.>
  • To liability for loss of or damage to the Aircraft or any consequential loss arising therefrom.
  • To any rotorwing aircraft or amphibious aircraft.
  • Non-Owned Aircraft Liability coverage hereunder will be excess over any other valid and collectible Insurance available to you."
    ;

    Document doc = new Document(@"C:\Temp\example\Policy Addendum.doc");

    DocumentBuilder builder = new DocumentBuilder(doc);

    builder.MoveToMergeField("non_owned_aircraft_liability_show");

    builder.InsertHtml(all_non_owned_aircraft_liability_exclude_rotorwing);

    doc.MailMerge.DeleteFields();

    doc.Save(@“C:\Temp\example\outfixed.docx”);


    In order to apply the margin-left property, the plain text fragments delimited by BR elements are replaced with paragraphs (P elements). Also, the margin-left property is applied to every LI element because currently Aspose.Words does not apply the margin-left property to an OL element to list items. I hope, this helps.

    If we can help you with anything else, please feel free to ask.

    Best regards,

    The issues you have found earlier (filed as WORDSNET-7950) have been fixed in this .NET update and this Java update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
    (3)

    The issues you have found earlier (filed as WORDSNET-7950) have been fixed in this .NET update and this Java update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
    (1)