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.

Fri Sep 28, 2018 7:27 am

Hello Support Team,

in another post I already described a very simlar problem, but the former solution doesn't help here.
What I am doing is generate a paragraph, get a style (called "SectionContent") from the documents StyleCollection and apply it to this paragraph.
After that, I append html to the paragraph. If I inspect the paragraph object, I can find the style and the character format.
In our case: FontName = Arial Narrow Size = 12.
When I save the document and open it in word, the added text (html) has a copied style-format ("SectionContent + 12px") with fontsize set to 12.
! Looks like the generated TextRange items are not affected by the paragraph style !

Please find the related code below:

Code: Select all
var outputDoc = new Spire.Doc.Document();
outputDoc.LoadFromFileInReadMode(templatePath, Spire.Doc.FileFormat.Docx);

var contentStyle = outputDoc.Styles.FindByName("SectionContent");

 var docSection = (Spire.Doc.Section)outputDoc.Sections.FirstItem;

docSection.Paragraphs.Clear();

var pContent = docSection.AddParagraph();
pContent.ApplyStyle(contentStyle.StyleId);
pContent.AppendHTML("<div>Is this Arial Narrow 9 Pt?</div>");

var docStream = new MemoryStream();
outputDoc.SaveToStream(docStream, Spire.Doc.FileFormat.Docx);



Best regards,
Arne Weber

arne.weber@webtelligence.net
 
Posts: 19
Joined: Mon Sep 19, 2016 6:52 am

Fri Sep 28, 2018 10:16 am

Hello Arne,

Thanks for your post.
To help us better investigate your issue, please provide your input template file and result file. Thanks in advance. You could send them to us via email( support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Oct 02, 2018 9:11 am

Hello Lisa,

With the hotfix, the issue is gone and the formatting is correct.
But now I have the license message within the document. Do I need a new license key?

Best regards,
Arne

arne.weber@webtelligence.net
 
Posts: 19
Joined: Mon Sep 19, 2016 6:52 am

Tue Oct 02, 2018 9:51 am

Dear Arne,

Thanks for your information.
Yes, you need to buy a new license since your license is expired now. Besides, our sales team will send a email to you with the discount for renewing your license.
If there is any question, welcome to get it back to us.

Sincerely
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc