InsertHTML - Problem with italic text

Hi,

I’ve got the following problem:

I create a doucument, then I insert HTML with DocumentBuilder InsertHtml method.
Then I convert to pdf.

Now I get the following problem:
italic Text section is now all the text behind starting italic. Text is not well formed at the left edge.

I added screen from created pdf file.

This is the html:
Die nachfolgenden Kapitel dienen der Analyse des Konkurrenzproduktes roXTra der Rossmanith GmbH aus Göppingen.

Anhand der Unternehmens- und produktbeurteilung soll herausgefunden werden, welche Erweiterungen für bitQMS sinnvoll wären und wo h Stärken und Schwächen sowohl im Produkt als auch im Vertrieb … zu suchen sind.

Hi

Thanks for your inquiry. I cannot reproduce the problem on my side. I use the latest version of Aspose.Words and the following code for testing:

string html = @"<p>Die nachfolgenden Kapitel dienen der Analyse des Konkurrenzproduktes roXTra der Rossmanith GmbH aus Göppingen. Anhand der Unternehmens- und *produktbeurteilung soll herausgefunden* werden, welche Erweiterungen für bitQMS sinnvoll wären und wo h Stärken und Schwächen sowohl im Produkt als auch im Vertrieb … zu suchen sind.</p>";
DocumentBuilder builder = new DocumentBuilder();
builder.InsertHtml(html);
builder.Document.Save(@"Test001\out.pdf");

You can download the latest version of Aspose.Words from here:
https://releases.aspose.com/words/net
Best regards.

Hi,

OK, that fits.

But I have still the problem, because my application is a little bit more complex.

I’m using a document as template, in which I import another document. The other document was filled by HTML Import with the help of DocumentBuilder.

For import I choose option ImportFormatMode.UseDestinationStyles, because I don’t want tu use normal style from html import doc.
And only in this scenario (option KeepSourceFormatting works fine) I get the problem described before.

Here is the code:

Aspose.Words.Document doc = new Aspose.Words.Document(some word template);

//Then I execute 3 mailmerges with own data sources.

//Then I create new import document

Aspose.Words.Document docImport = new Aspose.Words.Document();

//Then I import PageSetup from Template (not shown here) and then I use code from your documentation:

Aspose.Words.DocumentBuilder db = new Aspose.Words.DocumentBuilder(docImport);
string html = @"<P>Die nachfolgenden Kapitel dienen der Analyse des Konkurrenzproduktes roXTra der Rossmanith GmbH aus G&ouml;ppingen.<BR>Anhand der Unternehmens- und <EM>produktbeurteilung soll herausgefunden</EM> werden, welche Erweiterungen f&uuml;r bitQMS sinnvoll w&auml;ren und wo h St&auml;rken und Schw&auml;chen sowohl im Produkt als auch im Vertrieb &hellip; zu suchen sind.</P>";
db.InsertHtml(html);

Aspose.Words.Node insertAfterNode = doc.Sections[0].Body.LastChild;
Aspose.Words.CompositeNode dstStory = insertAfterNode.ParentNode;


Aspose.Words.NodeImporter importer = new Aspose.Words.NodeImporter(docImport, doc, Aspose.Words.ImportFormatMode.UseDestinationStyles);
foreach (Aspose.Words.Section srcSection in docImport.Sections)
{
    // Loop through all block level nodes (paragraphs and tables) in the body of the section.
    foreach (Aspose.Words.Node srcNode in srcSection.Body)
    {
        // Let's skip the node if it is a last empty paragarph in a section.
        if (srcNode.NodeType.Equals(Aspose.Words.NodeType.Paragraph))
        {
            Aspose.Words.Paragraph para = (Aspose.Words.Paragraph)srcNode;
            if (para.IsEndOfSection && !para.HasChildNodes)
                continue;
        }

        // This creates a clone of the node, suitable for insertion into the destination document.
        Aspose.Words.Node newNode = importer.ImportNode(srcNode, true);

        // Insert new node after the reference node.
        dstStory.InsertAfter(newNode, insertAfterNode);
    }

}

//Finally I save to PDF
doc.SaveToPdf(...);

Hi

Thank you for additional information. But I still cannot reproduce the problem on my side. As I can see you are using 9.1.0 version or older in your code (in the latest version SaveToPdf method was substituted with Save method). Please try using the latest version for testing.
Also, it would be great if you create a simple application, which will demonstrate the problem. I will check it and provide you more information.
Best regards,

Hi,

newest version, same problem.

I attached complete test solution for you.

Thanks
Christian

Hi

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue, you will be notified as soon as it is resolved.
Best regards.

The issues you have found earlier (filed as 18654) have been fixed in this update.

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