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 });
@kaiwachter
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27488
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
I will also move the topic into Aspose.Total category so my colleagues from Aspose.Slides team handle the question on their side.
@andrey.potapov Could you please take a look at this issue from Aspose.Slides side.
@kaiwachter,
Thank you for reporting on the issue. I’ve reproduced the problem you described when adding the HTML text to a PowerPoint presentation.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESNET-44730
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@kaiwachter “Poppins” is an MS Cloud font. AW will use it if the font will provided explicitly. Currently AW do not download MS Cloud fonts and do not use MS cloud fonts folder "%USERPROFILE%\AppData\Local\Microsoft\FontCache\4\CloudFonts"
as a font source. As a workaround you could add folder font source to MS cloud fonts folder (if running Aspose.Words on a machine where MS Word downloaded the font) or provide this font by other means.
It is highly unlikely that we will implement loading cloud fonts due to licensing. So the issue will be closed as “Not a Bug”.
The issues you found earlier (filed as SLIDESNET-44730) have been fixed in Aspose.Slides for .NET 24.11 (ZIP, MSI, NuGet, Cross-platform).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.