Hi Norbert,
Thanks for your inquiry. I can suggest you two workarounds.
-
The problem does not occur with DOC format. So you can open your document using MS Word as save it in DOC format and then process it using Aspose.Words. In this case locale options will be preserved.
-
You can try setting localeId programmatically.
https://reference.aspose.com/words/net/aspose.words/font/localeid/
I think the best way to achieve this is using DocumentVisitor. Please see the following code example.
Document doc = new Document(@"Test001\in.xml");
LocaleChanger changer = new LocaleChanger(2055);
doc.Accept(changer);
doc.Save(@"Test001\out.doc");
///
/// Class inherited from DocumentVisitor, that chnges localeId of each node to the localeId specified
///
class LocaleChanger : DocumentVisitor
{
public LocaleChanger(int localeId)
{
mLocaleId = localeId;
}
///
/// Called when a FieldEnd node is encountered in the document.
///
public override VisitorAction VisitFieldEnd(Aspose.Words.Fields.FieldEnd fieldEnd)
{
SetLocale(fieldEnd.Font);
return VisitorAction.Continue;
}
///
/// Called when a FieldSeparator node is encountered in the document.
///
public override VisitorAction VisitFieldSeparator(Aspose.Words.Fields.FieldSeparator fieldSeparator)
{
SetLocale(fieldSeparator.Font);
return VisitorAction.Continue;
}
///
/// Called when a FieldStart node is encountered in the document.
///
public override VisitorAction VisitFieldStart(Aspose.Words.Fields.FieldStart fieldStart)
{
SetLocale(fieldStart.Font);
return VisitorAction.Continue;
}
///
/// Called when a Footnote end is encountered in the document.
///
public override VisitorAction VisitFootnoteEnd(Footnote footnote)
{
SetLocale(footnote.Font);
return VisitorAction.Continue;
}
///
/// Called when a FormField node is encountered in the document.
///
public override VisitorAction VisitFormField(Aspose.Words.Fields.FormField formField)
{
SetLocale(formField.Font);
return VisitorAction.Continue;
}
///
/// Called when a Paragraph end is encountered in the document.
///
public override VisitorAction VisitParagraphEnd(Paragraph paragraph)
{
SetLocale(paragraph.ParagraphBreakFont);
return VisitorAction.Continue;
}
///
/// Called when a Run node is encountered in the document.
///
public override VisitorAction VisitRun(Run run)
{
SetLocale(run.Font);
return VisitorAction.Continue;
}
///
/// Called when a SpecialChar is encountered in the document.
///
public override VisitorAction VisitSpecialChar(SpecialChar specialChar)
{
SetLocale(specialChar.Font);
return VisitorAction.Continue;
}
private void SetLocale(Font font)
{
font.LocaleId = mLocaleId;
}
// locale by default is English - United States
private int mLocaleId = 1033;
}
Hope this helps.
Best regards.