Using Aspose.Words DocumentBuilder.InsertHtml
and Aspose.Slides Paragraph.AddFromHtml
has inconsistent behavior taking over the CSS font-family.
Example HTML:
<span style="font-family: "poppins" , "abc"">Hello World</span>
In Aspose.Words the font will be the last value of the CSS font-family values (e.g. "abc"
in example below).
In Aspose.Slides the font will be all values of the CSS font-family (e.g. "poppins, abc"
in the example below).
I would expect that Aspose would only take the first CSS font-family value (e.g in the example below it would just take "poppins"
.
See code below for reproduction:
using Aspose.Slides;
using Aspose.Words;
using System.Diagnostics;
var document = new Document();
var builder = new DocumentBuilder(document);
builder.InsertHtml("<span style=\"font-family: "poppins" , "abc"\">Hello World</span>");
document.Save("test.docx", SaveFormat.Docx);
using (var presentation = new Presentation())
{
var text = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 0, 0, 100, 100).AddTextFrame("test");
text.Paragraphs.AddFromHtml("<span style=\"font-family: "poppins" , "abc"\">Hello World</span>");
presentation.Save("test.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
// Font will be poppins, abc (=> all values)
Process.Start(new ProcessStartInfo { FileName = "test.pptx", UseShellExecute = true });
// Font will be abc (=> last value)
Process.Start(new ProcessStartInfo { FileName = "test.docx", UseShellExecute = true });