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

Free Support Forum - aspose.com

Changing Associated Character Properties in a document

I am using Aspose.Words .NET in conjunction with a third party editor that does not support Associated Character Properties in the RTF specification. Under some circumstances, when one of our users opens a document that has been created in MS Word, one or more runs in the document will have theses un-supported RTF tags ( \loch\af and \dbch\f according to their support staff) which causes the document to be rendered using different font (the attached document will use SimSum). Their suggestion was to either change the unsupported tags to \loch\f and \dbch\af in the source document before sending it to the editor, or to remove the fallback font for double byte characters. A quick test an can remove the fallback font for each run in the document by changing Run.Font.NameFarEast to use the same font as Run.Font.Name, but this seems like an expensive operation if I have to do it for each run in the document so I would prefer to avoid it if at all possible. How can I use aspose to change the unsupported RTF tags mentioned above to use the tags supported by our editor?

pre-convert.zip (2.7 KB)

@elliot.justice

Thanks for your inquiry. Please note you can not remove or update RTF tag directly using Aspose.Words but can change run node formatting after loading RTF into Aspose.Words Document object. Please share your existing sample code that you are using to change font of run node. We will look into it and will suggest you any improvement if possible.

Best Regards

@tilal.ahmad

Apologies for not being clear in my original post in regards to the supported RTF tags so allow me to clarify my question. Does the Aspose.Words API expose properties that would allow me to change one or more properties that would have the same (or similar) effect as me changing the \loch\af and \dbch\f tags in the raw RTF? If so what are the necessary properties I need to modify? If aspose does not expose propertie, thens my fallback to this issue would be to do something like the following (our language is c#)

Aspose.Words.Document doc1 = new Document(rtfFileName);
var runs = doc1.GetChildNodes(NodeType.Run, true)
    .Cast<Run>()
    .Where(r => r.Font.NameFarEast != r.Font.Name);
foreach (var r in runs)
    r.Font.NameFarEast = r.Font.Name;

@elliot.justice

Thanks for your feedback. Aspose.Words does not exposes properties for RTF tags but Font properties of run. Please check Font class for details. Furthermore, it seems you are following correct path to change the Fonts of runs.

Best Regards,