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

Free Support Forum - aspose.com

Foreign Language Punctuation/Grammar Rules

My project entails opening existing document and populating them with text in many languages. I am having an issue with Japanese now where the text in the document has the line starting with punctuation. I have attached 2 documents. J_Correct.dot is a document where the text is showing correctly and J_Incorrect.dot is a new document where it is not.

J_Correct.dot is a document that was created before I was here and I am not exactly sure why it is working other than it must be set up to know it is a Japanese text and to use Japanese rules with it.

I am not sure that this is the best way to test this consept, but I am trying to recreate this look in J_Incorrect without much luck. I have tried the following code from other places in the forum but it is not working. What else do I need to do to get this to work.

docbuilder.Font.LocaleIdFarEast = 1041
docbuilder.Font.LocaleId = 1041

objRuns = doc.GetChildNodes(NodeType.Run, True, False)
For Each objRun In objRuns
objRun.Font.LocaleIdFarEast = 1041
objRun.Font.LocaleId = 1041
objRun.Font.Name = "MS Gothic"
objRun.Font.Size = 9
Next

Hi
Brad,


Thanks for your inquiry. You just need to specify the locale so that Microsoft Word recognizes the text as Japanese. Please use the following code:

'Create a run of text that contains Russian
text.
<o:p></o:p>

Dim run As New Run(doc, "Привет")

'Specify the locale so Microsoft Word recognizes this text as Russian.

'For the list of locale identifiers see http://www.microsoft.com/globaldev/reference/lcid-all.mspx

run.Font.LocaleId = 1049


Please let us know if you need more information, we are always glad to help you.

Best Regards,

Awais,

Thanks for the reply. This is what I was doing, and when I open the document created after running this code, the second line still starts with a question mark. Again, I am opening the document running the following code and saving it and I still get the wrong results

objRuns = doc.GetChildNodes(NodeType.Run, True, False)

For Each objRun In objRuns
objRun.Font.LocaleIdFarEast = 1041
objRun.Font.LocaleId = 1041
objRun.Font.Name = "MS Gothic"
objRun.Font.Size = 9
Next

It seems that I should be able to run this to tell word that it is Japanese and then open the document and see the text displayed correctly.

Brad

Hi Brad,

Thanks for your inquiry. I'm afraid, I still can't reproduce this problem on my side using the latest version of Aspose.Words i.e. 11.1.0, code you supplied and the input document you attached. Could you please double check if you are using the latest version (11.1.0)? You can dynamically check if you're referencing the correct DLL by using the following code snippet:

System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (System.Reflection.Assembly assembly in assemblies)
{
System.Reflection.AssemblyName assemblyName = assembly.GetName();
if (assemblyName.Name.Contains("Aspose.Words"))
Console.WriteLine("Aspose.Words Version Number: " + assemblyName.Version.ToString());
}

Moreover, you can download the latest version from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

If we can help you with anything else, please feel free to ask.

Best Regards,