I have a question about language in Word.
I tested with the evaluation version of aspose.word .net 7.0.0 the conversion of one document from WordML to DOC (just open and save, no more).
The original WordML document has the language “German (Switzerland)” (in all paragraphs).
The converted DOC document instead has an other language, but i don’t know which (nothing ist marked). I added a picture of language settings (see attachment).
Furthermore the hyphenation is lost.
If you need i can send you the documents via email.
Thanks for your inquiry. Please attach your document here for testing. I will check the issue on my side and provide you more information. Only you and Aspose staff members can download files attached in the forum.
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.
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;
}
I’m afraid this issue is still unresolved. We will inform you of any developments. Are the work arounds suggested for you previously still working in your application?