We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting html does not use formating of mergefield/ context

Hi,

i am using like this.

for(int i=0;i<docmailmerragefields.Length;;i++)
{
if (docmailmerragefields[i].Equals(“BarcodeString”))
{
bbb.MoveToMergeField(“BarcodeString”);

bbb.InsertHtml(BarcodeString);

}
}

here bb mean documentbulider…

my probleam:
The font formatting is"Calibri" coming
instead of “TimesNewRoman”.

can you change my code in c# only please…


This message was posted using Page2Forum from Aspose.Words for .NET - Documentation

Hi

Thanks for your request. As you already read in the following thread:

Starting from 9.5.0 version behavior of InsertHtml was changed. Now content inserted by Insert HTML does not inherit formatting specified in DocumentBuilder options. Whole formatting is taken from HTML snippet. If you insert HTML with no formatting specified, default formatting is used for inserted content, i.e. if font is not specified in your HTML snippet, default font will be applied (Times New Roman). If you would like that the inserted HTML inherit formatting of DocumentBuilder, you can use the code suggested in the above mentioned thread to simply specify font in your HTML.

Best regards,

sorry i need code in c#please help me

Hi

Thanks for your request. You can find C# code example here:

https://forum.aspose.com/t/53489

Best regards,

sorry i need in c# please help man…


i think is the solution…

case NodeType.RUN:

Run run = (Run) node;

Run defaultRun = null;

if (htmlBuilder.getCurrentNode() != null)

{

htmlBuilder.insertHtml(" ");

defaultRun = (Run)htmlBuilder.getCurrentNode().getPreviousSibling();

}

copyFormatting(builder.getFont(), run.getFont(), defaultRun != null ? defaultRun.getFont() : htmlBuilder.getFont());

if (defaultRun != null)

defaultRun.remove();

break;


i need this code in c#,with my code,where i need to use this code please give complete details.....

Hi

Thanks for your request. Please see my answer here:

http://www.aspose.com/community/forums/2/320292/inserting-html-does-not-use-formating-of-mergefield-context/showthread.aspx#320292

Best regards,