Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Jan 30, 2018 8:47 am

Hi,

I'm using a WYSIWYG HTML Editor on a webpage, where the users can build a document with misc variables configured in another section. This is working like it should.

Image

I do have one main challenge with fonts. If i build the word document with AddSection(), the final word document always uses "Times New Roman" font. I then tried to build a HTML page with all the content and import it into Spire.Doc - but this also uses "Times New Roman" even tho each HTML element has a style font-family "arial, helvetica, sans-serif" defined.

Attached ZIP file - Couldn't attach files - direct link

39e14b54-3bfd-4525-9e83-bc7894d53db0.html
This file is created based on the content from the HTML editor.

39e14b54-3bfd-4525-9e83-bc7894d53db0.docx
This file is the HTML file loaded into Spire.Doc and saved as a Docx file.

When creating the docx file - EmbedFontsInFile and EmbedSystemFonts is set to true.

Is there any way to make Spire.Doc / Word use the fonts defined on HTML elements?

Thanks in advance
Last edited by carstenp on Tue Jan 30, 2018 9:34 am, edited 1 time in total.

carstenp
 
Posts: 5
Joined: Wed Sep 28, 2016 5:49 am

Tue Jan 30, 2018 9:32 am

I did some more investigation in regards to fonts. Microsoft Word can't handle combination of fonts ex. "arial, helvetica, sans-serif". I fixed this by changing the font list in the WYSIWYG editor (config), so each font only contain a single font and not a combination of multiple fonts.

Which means, this isn't a Spire.Doc problem/bug - but a "limitation" in Microsoft Word.

carstenp
 
Posts: 5
Joined: Wed Sep 28, 2016 5:49 am

Tue Jan 30, 2018 10:14 am

Hello,

Thanks for your sharing.
Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.Doc