Hi, I have a DOTX template that contains custom styles and load the template into a DocumentBuilder, insert HTML into the template and save it as a DOCX file. In my HTML I have classes which has same name as in my template. Is it possible to link the HTML class to the custom style in the template in order to keep formats defined in the template? OR Can we have any workaround?
Hi Vuong,
Hi awais.hafeez,
Content of P
Hi there,
<span style=“font-size:
10.0pt;font-family:“Courier New”;color:blue;mso-no-proof:yes”>
InsertHtmlUsingDocumentStyles(builder, ".MyStyle{color:red;}Text
");
public static void InsertHtmlUsingDocumentStyles(DocumentBuilder builder, string html)
{
Document tempDoc = new Document(new MemoryStream(Encoding.UTF8.GetBytes(html)));
NodeImporter importer = new NodeImporter(tempDoc, builder.Document, ImportFormatMode.UseDestinationStyles);
Node currentNode = builder.CurrentParagraph;
foreach (Node node in tempDoc.FirstSection.Body.ChildNodes)
{
Node importNode = importer.ImportNode(node, true);
currentNode.ParentNode.InsertAfter(importNode, currentNode);
currentNode = importNode;
}
builder.MoveTo(currentNode);
}
The issues you have found earlier (filed as WORDSNET-1432) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(15)